Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
curvedflats
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
6
Issues
6
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Flatland
curvedflats
Commits
78ae1c4e
Commit
78ae1c4e
authored
Aug 02, 2019
by
Chae Ho Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
attempt at model-view integration
parent
a072752f
Changes
29
Show whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
3801 additions
and
306 deletions
+3801
-306
Object1Mat.mat
...ts/Cross Section Shader/Examples/Materials/Object1Mat.mat
+81
-0
Object1Mat.mat.meta
...oss Section Shader/Examples/Materials/Object1Mat.mat.meta
+8
-0
OnePlaneCrossSection.mat
...ection Shader/Examples/Materials/OnePlaneCrossSection.mat
+3
-3
PlayerMaterial.mat
...ross Section Shader/Examples/Materials/PlayerMaterial.mat
+81
-0
PlayerMaterial.mat.meta
...Section Shader/Examples/Materials/PlayerMaterial.mat.meta
+8
-0
PathCollider.prefab
Assets/Prefabs/PathCollider.prefab
+1
-1
MainView.renderTexture
Assets/Resources/MainView.renderTexture
+36
-0
MainView.renderTexture.meta
Assets/Resources/MainView.renderTexture.meta
+8
-0
Materials.meta
Assets/Resources/Materials.meta
+8
-0
MainView.mat
Assets/Resources/Materials/MainView.mat
+77
-0
MainView.mat.meta
Assets/Resources/Materials/MainView.mat.meta
+8
-0
New Material.mat
Assets/Resources/New Material.mat
+1
-1
RuntimeCSGFlatlandObject.cs
Assets/RuntimeCSGFlatlandObject.cs
+0
-97
Test.unity
Assets/Scenes/Test.unity
+3213
-167
CameraMovement.cs
Assets/Scripts/CameraMovement.cs
+34
-3
ConeMovement.cs
Assets/Scripts/ConeMovement.cs
+19
-0
ConeMovement.cs.meta
Assets/Scripts/ConeMovement.cs.meta
+11
-0
ExtrudedMesh.cs
Assets/Scripts/ExtrudedMesh.cs
+19
-3
FlatlandMaterial.mat
Assets/Scripts/FlatlandMaterial.mat
+1
-1
LevelManager.cs
Assets/Scripts/LevelManager.cs
+21
-0
LevelManager.cs.meta
Assets/Scripts/LevelManager.cs.meta
+11
-0
PathRenderer.cs
Assets/Scripts/PathRenderer.cs
+11
-4
Planemovement.cs
Assets/Scripts/Planemovement.cs
+11
-8
PlayerMovement.cs
Assets/Scripts/PlayerMovement.cs
+68
-0
PlayerMovement.cs.meta
Assets/Scripts/PlayerMovement.cs.meta
+11
-0
RuntimeCSGFlatlandObject.cs
Assets/Scripts/RuntimeCSGFlatlandObject.cs
+33
-0
RuntimeCSGFlatlandObject.cs.meta
Assets/Scripts/RuntimeCSGFlatlandObject.cs.meta
+0
-0
VelocitySlider.cs
Assets/Scripts/VelocitySlider.cs
+18
-18
VelocitySlider.cs.meta
Assets/Scripts/VelocitySlider.cs.meta
+0
-0
No files found.
Assets/Cross Section Shader/Examples/Materials/Object1Mat.mat
0 → 100644
View file @
78ae1c4e
%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
}
Assets/Cross Section Shader/Examples/Materials/Object1Mat.mat.meta
0 → 100644
View file @
78ae1c4e
fileFormatVersion: 2
guid: fd4273201b73ef547b3b8fa05fe14f86
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
Assets/Cross Section Shader/Examples/Materials/OnePlaneCrossSection.mat
View file @
78ae1c4e
...
...
@@ -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
}
Assets/Cross Section Shader/Examples/Materials/PlayerMaterial.mat
0 → 100644
View file @
78ae1c4e
%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
}
Assets/Cross Section Shader/Examples/Materials/PlayerMaterial.mat.meta
0 → 100644
View file @
78ae1c4e
fileFormatVersion: 2
guid: 7286fb01c3bf28349bf3a51860aefb00
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
Assets/Prefabs/PathCollider.prefab
View file @
78ae1c4e
...
...
@@ -58,7 +58,7 @@ MeshRenderer:
m_RenderingLayerMask
:
1
m_RendererPriority
:
0
m_Materials
:
-
{
fileID
:
10
303
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
-
{
fileID
:
10
754
,
guid
:
0000000000000000f000000000000000
,
type
:
0
}
m_StaticBatchInfo
:
firstSubMesh
:
0
subMeshCount
:
0
...
...
Assets/Resources/MainView.renderTexture
0 → 100644
View file @
78ae1c4e
%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
Assets/Resources/MainView.renderTexture.meta
0 → 100644
View file @
78ae1c4e
fileFormatVersion: 2
guid: 13da20cf2d7183242bb9d73fcb1d0b9d
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 8400000
userData:
assetBundleName:
assetBundleVariant:
Assets/Resources/Materials.meta
0 → 100644
View file @
78ae1c4e
fileFormatVersion: 2
guid: 04f9e263ed3c22345b5b292a3827878f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
Assets/Resources/Materials/MainView.mat
0 → 100644
View file @
78ae1c4e
%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
}
Assets/Resources/Materials/MainView.mat.meta
0 → 100644
View file @
78ae1c4e
fileFormatVersion: 2
guid: d9e571230563e11479f4f7e74d2189ab
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
Assets/Resources/New Material.mat
View file @
78ae1c4e
...
...
@@ -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
...
...
Assets/RuntimeCSGFlatlandObject.cs
deleted
100644 → 0
View file @
a072752f
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;
}
}
Assets/Scenes/Test.unity
View file @
78ae1c4e
This source diff could not be displayed because it is too large. You can
view the blob
instead.
Assets/Scripts/CameraMovement.cs
View file @
78ae1c4e
...
...
@@ -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
Fixed
Update
()
{
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
);
}
}
Assets/Scripts/ConeMovement.cs
0 → 100644
View file @
78ae1c4e
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
;
}
}
Assets/Scripts/ConeMovement.cs.meta
0 → 100644
View file @
78ae1c4e
fileFormatVersion: 2
guid: 7589de6aed0d2534f9d48259260f406e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/ExtrudedMesh.cs
View file @
78ae1c4e
...
...
@@ -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
,
10
0
);
Destroy
(
clone
,
3
0
);
prevtime
=
sections
[
sections
.
Count
-
1
].
time
;
}
...
...
Assets/Scripts/FlatlandMaterial.mat
View file @
78ae1c4e
...
...
@@ -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
}
...
...
Assets/Scripts/LevelManager.cs
0 → 100644
View file @
78ae1c4e
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
()
{
}
}
Assets/Scripts/LevelManager.cs.meta
0 → 100644
View file @
78ae1c4e
fileFormatVersion: 2
guid: 14f968d942299c84ca786317f6de8274
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/PathRenderer.cs
View file @
78ae1c4e
...
...
@@ -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
)
{
...
...
Assets/Scripts/Planemovement.cs
View file @
78ae1c4e
...
...
@@ -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);
...
...
Assets/Scripts/PlayerMovement.cs
0 → 100644
View file @
78ae1c4e
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)
}
}
Assets/Scripts/PlayerMovement.cs.meta
0 → 100644
View file @
78ae1c4e
fileFormatVersion: 2
guid: 9cbe363fdf02257478cb799cdf2190b3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
Assets/Scripts/RuntimeCSGFlatlandObject.cs
0 → 100644
View file @
78ae1c4e
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
()
{
}
}
Assets/RuntimeCSGFlatlandObject.cs.meta
→
Assets/
Scripts/
RuntimeCSGFlatlandObject.cs.meta
View file @
78ae1c4e
File moved
Assets/VelocitySlider.cs
→
Assets/
Scripts/
VelocitySlider.cs
View file @
78ae1c4e
Assets/VelocitySlider.cs.meta
→
Assets/
Scripts/
VelocitySlider.cs.meta
View file @
78ae1c4e
File moved
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment