Skip to content

Commit 1acc517

Browse files
committed
Started work on bounding volumes.
1 parent 1368f17 commit 1acc517

File tree

3 files changed

+29
-14
lines changed

3 files changed

+29
-14
lines changed

UnityProject/Assets/Scenes/DemoScene.unity

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3322,17 +3322,9 @@ MonoBehaviour:
33223322
assetGuid:
33233323
m_Mesh: {fileID: 160132371}
33243324
m_IsSelectable: 1
3325-
m_SelectedFaces: 00000000
3326-
m_SelectedEdges:
3327-
- a: 0
3328-
b: 1
3329-
- a: 2
3330-
b: 0
3331-
- a: 1
3332-
b: 3
3333-
- a: 3
3334-
b: 2
3335-
m_SelectedVertices: 00000000010000000200000003000000
3325+
m_SelectedFaces:
3326+
m_SelectedEdges: []
3327+
m_SelectedVertices:
33363328
--- !u!4 &96482899
33373329
Transform:
33383330
m_ObjectHideFlags: 0
@@ -6612,7 +6604,7 @@ MonoBehaviour:
66126604
m_EditorClassIdentifier:
66136605
rayTracer: {fileID: 7200000, guid: 5d3ecc91e10e8bd4783d493b91f7f36b, type: 3}
66146606
directionalLight: {fileID: 705507994}
6615-
skyBoxTexture: {fileID: 2800000, guid: c1d47be90deb5584486e602ba3a9c622, type: 3}
6607+
skyBoxTexture: {fileID: 2800000, guid: a105db47e882af24481ac6b550f184aa, type: 3}
66166608
--- !u!1001 &1306028894
66176609
PrefabInstance:
66186610
m_ObjectHideFlags: 0

UnityProject/Assets/Scripts/AddToPathEngine.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ public class AddToPathEngine : MonoBehaviour
2121
public Vector3 emissionColor = new Vector3(0f, 0f, 0f);
2222
public float emissionStrength = 0.0f;
2323

24+
Vector3 centerPosition;
25+
float radius;
26+
2427
[HideInInspector]
2528
public Vector3 emission;
2629

@@ -44,9 +47,28 @@ private void OnEnable()
4447
emission = emissionStrength * emissionColor;
4548

4649
RayTracing.RegisterObject(this);
50+
51+
4752
}
53+
4854
private void OnDisable()
4955
{
5056
RayTracing.UnregisterObject(this);
5157
}
58+
59+
Vector3 meshAverage(Mesh mesh)
60+
{
61+
Vector3[] vertexList = mesh.vertices;
62+
63+
Vector3 average = Vector3.zero;
64+
int count = 0;
65+
66+
foreach (Vector3 vertex in vertexList)
67+
{
68+
average += vertex;
69+
count++;
70+
}
71+
72+
return average / count;
73+
}
5274
}

UnityProject/Assets/Scripts/RayTracing.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,10 @@ void Update()
221221
}
222222

223223
Vector3 currentPosition = camera.transform.localPosition;
224+
Vector3 currentRotation = GetComponent<Camera>().transform.localEulerAngles;
224225

225-
camera.transform.Rotate(new Vector3(0, Input.GetAxis("Horizontal") * rotationSpeed * Time.deltaTime, 0));
226-
camera.transform.Rotate(new Vector3(-Input.GetAxis("Vertical") * rotationSpeed * Time.deltaTime, 0, 0));
226+
currentRotation = currentRotation + new Vector3(-Input.GetAxis("Vertical"), Input.GetAxis("Horizontal"), 0) * rotationSpeed * Time.deltaTime;
227+
camera.transform.localEulerAngles = currentRotation;
227228

228229
if (Input.GetAxis("Horizontal") != 0 || Input.GetAxis("Vertical") != 0)
229230
{

0 commit comments

Comments
 (0)