Commit 78ae1c4e authored by Chae Ho Shin's avatar Chae Ho Shin

attempt at model-view integration

parent a072752f
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Object1Mat
m_Shader: {fileID: 4800000, guid: dfb2ef60de11e934f9e7571d2eb7bf08, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilMask: 255
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _CrossColor: {r: 0, g: 0, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _PlaneNormal: {r: 0, g: 1, b: 0, a: 0}
- _PlanePosition: {r: 0, g: 0, b: 0, a: 1}
fileFormatVersion: 2
guid: fd4273201b73ef547b3b8fa05fe14f86
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
......@@ -13,7 +13,7 @@ Material:
m_LightmapFlags: 5
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2000
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
......@@ -71,7 +71,7 @@ Material:
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 0, b: 0, a: 1}
- _CrossColor: {r: 1, g: 1, b: 1, a: 1}
- _CrossColor: {r: 1, g: 0, b: 0, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _PlaneNormal: {r: 0, g: 1, b: 0, a: 0}
- _PlanePosition: {r: 0, g: 0.98, b: 0, a: 1}
- _PlanePosition: {r: 0, g: 0, b: 0, a: 1}
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: PlayerMaterial
m_Shader: {fileID: 4800000, guid: dfb2ef60de11e934f9e7571d2eb7bf08, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _StencilMask: 255
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _CrossColor: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _PlaneNormal: {r: 0, g: 1, b: 0, a: 0}
- _PlanePosition: {r: 0, g: 0, b: 0, a: 1}
fileFormatVersion: 2
guid: 7286fb01c3bf28349bf3a51860aefb00
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
......@@ -58,7 +58,7 @@ MeshRenderer:
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10754, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
......
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!84 &8400000
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: MainView
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
serializedVersion: 3
m_Width: 1600
m_Height: 900
m_AntiAliasing: 1
m_DepthFormat: 2
m_ColorFormat: 8
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_EnableCompatibleFormat: 1
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 0
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1
fileFormatVersion: 2
guid: 13da20cf2d7183242bb9d73fcb1d0b9d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 8400000
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 04f9e263ed3c22345b5b292a3827878f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: MainView
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: ETC1_EXTERNAL_ALPHA
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 8400000, guid: 13da20cf2d7183242bb9d73fcb1d0b9d, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
fileFormatVersion: 2
guid: d9e571230563e11479f4f7e74d2189ab
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
......@@ -9,7 +9,7 @@ Material:
m_PrefabAsset: {fileID: 0}
m_Name: New Material
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_ShaderKeywords: ETC1_EXTERNAL_ALPHA
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MeshMakerNamespace;
public class RuntimeCSGFlatlandObject : MonoBehaviour
{
public GameObject PastLightCone;
public GameObject crosssection;
public Mesh m;
int cnt = 0;
public CSG csg;
// Start is called before the first frame update
void Start()
{
//CSG.EPSILON = 1e-5f; // Adjustable epsilon value
//csg = new CSG();
//csg.Target = transform.gameObject;
PastLightCone = GameObject.Find("Cone");
//csg.Brush = PastLightCone;
//csg.OperationType = CSG.Operation.Intersection;
//Destroy(crosssection);
//GameObject tmp = csg.PerformCSG();
//crosssection = csg.PerformCSG();
crosssection = new GameObject();
crosssection.name = "Thecrosssection";
Physics.IgnoreLayerCollision(8, 8);
m = new Mesh();
}
// Update is called once per frame
void Update()
{
/*if (cnt % 120 == 0)
{
cnt = 0;
Destroy(crosssection);
GameObject tmp = csg.PerformCSG();
crosssection = tmp;
}
cnt++;*/
}
public void OnCollisionStay(Collision collision)
{
//Debug.Log("Wow!");
if (collision.collider.gameObject == PastLightCone)
{
crosssection.name = "hit!";
/*Debug.Log("Contact count : " + collision.contactCount);
int vertexCount = collision.contactCount;
Vector3[] vertices = new Vector3[vertexCount];
int[] indices = new int[vertexCount];
for (int i = 0; i < vertexCount; i++)
{
vertices[i] = collision.GetContact(i).point;
indices[i] = i;
}
m.Clear();
m.vertices = vertices;
m.SetIndices(indices, MeshTopology.Points, 0);
m.RecalculateBounds();
m.RecalculateNormals();
MeshFilter mf = GetComponent<MeshFilter>();
mf.mesh = m;
Debug.Log(m.bounds);*/
}
}
public void OnTriggerEnter(Collider other)
{
//Debug.Log( "Trigger hit!");
//if(other.gameObject == PastLightCone)
//{
//crosssection.name = "hit!";
//GameObject tmp = csg.PerformCSG();
//tmp.name = "wow!";
//crosssection = tmp;
//}
//crosssection = csg.PerformCSG();
//GameObject tmp = csg.PerformCSG();
//crosssection = tmp;
}
}
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -4,15 +4,46 @@ using UnityEngine;
public class CameraMovement : MonoBehaviour
{
public LevelManager Levelmanager;
Camera thecamera;
double aspect;
//public double playergamma;
// Start is called before the first frame update
void Start()
{
//playergamma = 1.0f;
thecamera = GetComponent<Camera>();
aspect = 16.0f / 9.0f;
}
// Update is called once per frame
void Update()
void FixedUpdate()
{
transform.Translate(Vector3.up * Time.deltaTime, Space.World);
transform.position = Levelmanager.player.transform.position;
var v = Levelmanager.player.v;
var vt = v + Vector3.up;
vt.x = -vt.x;
vt.z = -vt.z;
vt.Normalize();
Vector3 newforward = new Vector3(vt.y * (v.x / v.magnitude), Mathf.Sqrt(vt.x * vt.x + vt.z * vt.z), vt.y * (v.z / v.magnitude));
transform.rotation = Quaternion.LookRotation(-vt, newforward);
thecamera.orthographicSize = 5.0f * ((float)Levelmanager.player.gamma);
aspect = 16.0f / (9.0f * (Levelmanager.player.gamma));
thecamera.aspect = (float)aspect;
transform.Translate(-Vector3.forward * 5);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ConeMovement : MonoBehaviour
{
public LevelManager Levelmanager;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void FixedUpdate()
{
transform.position = Levelmanager.player.transform.position;
}
}
fileFormatVersion: 2
guid: 7589de6aed0d2534f9d48259260f406e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -41,12 +41,14 @@ public class ExtrudedMesh : MonoBehaviour
precomputedEdges = MeshExtrusion.BuildManifoldEdges(srcMesh);
GetComponent<MeshCollider>().sharedMesh = GetComponent<MeshFilter>().mesh;
prevtime = Time.time;
transform.SetAsFirstSibling();
}
List<ExtrudedTrailSection> sections = new List<ExtrudedTrailSection>();
void LateUpdate()
{
transform.SetAsFirstSibling();
var position = transform.position;
var rotation = transform.rotation;
var now = Time.time + 0.5f * (float)time;
......@@ -54,17 +56,31 @@ public class ExtrudedMesh : MonoBehaviour
// Remove old sections
while (sections.Count > 0 && now > sections[sections.Count - 1].time + time)
{
if(sections[sections.Count - 1].time - prevtime > 0.5f * time && leaveworldline)
if(sections[sections.Count - 1].time - prevtime > time * 0.5f && leaveworldline)
{
var clone = Instantiate(transform.parent.gameObject, transform.parent.position, transform.parent.rotation);
clone.GetComponentInChildren<MeshFilter>().sharedMesh = clone.GetComponentInChildren<MeshFilter>().mesh;
DestroyImmediate(clone.GetComponent<Planemovement>());
var x = clone.GetComponents(typeof(Component));
foreach(var t in x)
{
if ((t is Transform))
{
continue;
}
else
DestroyImmediate(t);
; }
if (clone.transform.childCount > 1)
{
DestroyImmediate(clone.transform.GetChild(1).gameObject);
}
DestroyImmediate(clone.GetComponentInChildren<ExtrudedMesh>());
clone.GetComponentInChildren<MeshCollider>().convex = true;
clone.GetComponentInChildren<MeshCollider>().sharedMesh = clone.GetComponentInChildren<MeshFilter>().mesh;
clone.transform.GetChild(0).gameObject.AddComponent<RuntimeCSGFlatlandObject>();
clone.layer = 8;
clone.transform.GetChild(0).gameObject.layer = 8;
Destroy(clone, 100);
Destroy(clone, 30);
prevtime = sections[sections.Count - 1].time;
}
......
......@@ -75,7 +75,7 @@ Material:
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 0}
- _Color: {r: 1, g: 0, b: 0, a: 0}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _GlowColor: {r: 1, g: 0, b: 0, a: 1}
- _HighlightColor: {r: 1, g: 1, b: 1, a: 1}
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class LevelManager : MonoBehaviour
{
public double gamma;
public PlayerMovement player;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}
fileFormatVersion: 2
guid: 14f968d942299c84ca786317f6de8274
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -68,12 +68,19 @@ public class PathRenderer : MonoBehaviour
}
private void _DrawMorePath(Vector3 point)
{
if (square.pathList.Count == 0)
{
_DrawOnePath(point);
}
else
{
square.pathList.Add(point);
_pathRenderer.positionCount = square.pathList.Count();
_pathRenderer.SetPositions(square.pathList.ToArray());
_InstantiatePathCollider(square.pathList.Count() - 2);
}
}
private void _InstantiatePathCollider(int n)
{
......
......@@ -9,6 +9,8 @@ public class Planemovement : MonoBehaviour
double beta = 0.5f; // v/c
Vector3 alpha = new Vector3(0.1f, 0.0f, 0.0f); // proper acceleration
Vector3 v;
public LevelManager Levelmanager;
public double playergamma;
// Start is called before the first frame update
public GameObject theobject;
......@@ -16,10 +18,11 @@ public class Planemovement : MonoBehaviour
void Start()
{
Renderer r = theobject.GetComponent<Renderer>();
//Renderer r = theobject.GetComponent<Renderer>();
//Color materialColor = r.material.color;
//r.material.color = Color.clear;
v = new Vector3(0.0f, 0.0f, 0.0f);
playergamma = 1.0f;
}
// Update is called once per frame
......@@ -29,19 +32,19 @@ public class Planemovement : MonoBehaviour
{
var prevup = transform.up;
var prevfor = transform.forward;
transform.Translate(Vector3.up * Time.fixedDeltaTime, Space.World); // move up by 1 second
cnt++;
if (cnt % 480 == 0)
{
cnt = 0;
}
transform.Translate(Vector3.up * Time.fixedDeltaTime * (float)Levelmanager.player.gamma, Space.World); // move up by 1 second
//cnt++;
//if (cnt % 480 == 0)
//{
// cnt = 0;
//}
//transform.Translate(Vector3.forward * Time.fixedDeltaTime, Space.World);
//transform.Translate(0.5f*Vector3.forward * Mathf.Cos(2*Mathf.PI*cnt/480) * Time.fixedDeltaTime, Space.World);
//transform.Translate(0.5f*Vector3.left * Mathf.Sin(2 * Mathf.PI * cnt / 480) * Time.fixedDeltaTime, Space.World);
//v = (float)beta * Vector3.forward * Mathf.Cos(2 * Mathf.PI * cnt / 480) + (float)beta * Vector3.left * Mathf.Sin(2 * Mathf.PI * cnt / 480);
v = alpha.normalized * (alpha.magnitude * Time.time / Mathf.Sqrt(1.0f+(alpha.magnitude * Time.time)*(alpha.magnitude * Time.time)));
//v = alpha.normalized * (alpha.magnitude * Time.time / Mathf.Sqrt(1.0f+(alpha.magnitude * Time.time)*(alpha.magnitude * Time.time)));
//v = new Vector3(0, 0, 0);
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerMovement : MonoBehaviour
{
//int cnt = 0;
double beta = 0.5f; // v/c
public Vector3 alpha = new Vector3(0.1f, 0.0f, 0.0f); // proper acceleration
public Vector3 v = new Vector3(0.0f, 0.0f, 0.0f);
public double gamma = 1.0f;
public GameObject theobject;
int cnt = 0;
// Start is called before the first frame update
void Start()
{
v = new Vector3(0.0f, 0.0f, 0.0f);
gamma = 1.0f;
cnt = 0;
}
// Update is called once per frame
void FixedUpdate()
{
var prevup = transform.up;
var prevfor = transform.forward;
transform.Translate(Vector3.up * Time.fixedDeltaTime * (float)gamma, Space.World); // move up by 1 second
cnt++;
if (cnt % 480 == 0)
{
cnt = 0;
}
//transform.Translate(Vector3.forward * Time.fixedDeltaTime, Space.World);
//transform.Translate(0.5f*Vector3.forward * Mathf.Cos(2*Mathf.PI*cnt/480) * Time.fixedDeltaTime, Space.World);
//transform.Translate(0.5f*Vector3.left * Mathf.Sin(2 * Mathf.PI * cnt / 480) * Time.fixedDeltaTime, Space.World);
//v = (float)beta * Vector3.forward * Mathf.Cos(2 * Mathf.PI * cnt / 480) + (float)beta * Vector3.left * Mathf.Sin(2 * Mathf.PI * cnt / 480);
v = alpha.normalized * (alpha.magnitude * Time.time / Mathf.Sqrt(1.0f + (alpha.magnitude * Time.time) * (alpha.magnitude * Time.time)));
beta = v.magnitude / 1.0f;
gamma = 1.0f / Mathf.Sqrt(1.0f - (float)(beta * beta));
transform.Translate(v * Time.fixedDeltaTime, Space.World);
var vt = v + Vector3.up;
vt.x = -vt.x;
vt.z = -vt.z;
vt.Normalize();
transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); // release child to change x'-axis scale
theobject.transform.up = vt;
theobject.transform.parent = null;
Vector3 newforward = new Vector3(vt.y * (v.x / v.magnitude), Mathf.Sqrt(vt.x * vt.x + vt.z * vt.z), vt.y * (v.z / v.magnitude));
transform.rotation = Quaternion.LookRotation(newforward, vt);
theobject.transform.parent = transform;
transform.localScale = new Vector3(1.0f, 1.0f, (float)gamma); // scale x'-axis scale (distance dilation)
}
}
fileFormatVersion: 2
guid: 9cbe363fdf02257478cb799cdf2190b3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using MeshMakerNamespace;
public class RuntimeCSGFlatlandObject : MonoBehaviour
{
public GameObject PastLightCone;
public GameObject crosssection;
public Mesh m;
int cnt = 0;
public CSG csg;
// Start is called before the first frame update
void Start()
{
PastLightCone = GameObject.Find("Cone");
Physics.IgnoreLayerCollision(8, 8);
}
// Update is called once per frame
void Update()
{
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment