Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3879308

Browse files
committed
add planeIntersection scene and example with raycast
1 parent fd53567 commit 3879308

File tree

3 files changed

+30
-13
lines changed

3 files changed

+30
-13
lines changed

‎Assets/PlaneRayIntersection.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
public class PlaneRayIntersection : MonoBehaviour
44
{
55
public GameObject sphere;
6-
public Transform corner1;
7-
public Transform corner2;
8-
public Transform corner3;
6+
public GameObject quad;
97

108
Plane mPlane;
119

1210
void Start()
1311
{
14-
mPlane = new Plane(corner1.position, corner2.position, corner3.position);
12+
Vector3[] vertices = quad.GetComponent<MeshFilter>().mesh.vertices;
13+
mPlane = new Plane(quad.transform.TransformPoint(vertices[0]), quad.transform.TransformPoint(vertices[1]), quad.transform.TransformPoint(vertices[2]));
1514
}
1615

1716
void Update()

‎Assets/new_scene.unity renamed to ‎Assets/planeIntersection.unity

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ Transform:
208208
m_PrefabAsset: {fileID: 0}
209209
m_GameObject: {fileID: 120958607}
210210
serializedVersion: 2
211-
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
212-
m_LocalPosition: {x: 0, y: 1, z: -10}
211+
m_LocalRotation: {x: -0.28152227, y: -0.4507957, z: 0.15229604, w: -0.83326733}
212+
m_LocalPosition: {x: -5.4418335, y: 5.584738, z: -4.0866995}
213213
m_LocalScale: {x: 1, y: 1, z: 1}
214214
m_ConstrainProportionsScale: 0
215215
m_Children: []
@@ -314,7 +314,7 @@ Transform:
314314
m_GameObject: {fileID: 298229493}
315315
serializedVersion: 2
316316
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
317-
m_LocalPosition: {x: 1.3785745, y: -0.16138363, z: -1.0489963}
317+
m_LocalPosition: {x: 2.1140213, y: 0.00000020861626, z: -1.739898}
318318
m_LocalScale: {x: 1, y: 1, z: 1}
319319
m_ConstrainProportionsScale: 0
320320
m_Children: []
@@ -329,8 +329,9 @@ GameObject:
329329
serializedVersion: 6
330330
m_Component:
331331
- component: {fileID: 523461483}
332+
- component: {fileID: 523461484}
332333
m_Layer: 0
333-
m_Name: GameObject
334+
m_Name: Intersect
334335
m_TagString: Untagged
335336
m_Icon: {fileID: 0}
336337
m_NavMeshLayer: 0
@@ -351,6 +352,23 @@ Transform:
351352
m_Children: []
352353
m_Father: {fileID: 0}
353354
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
355+
--- !u!114 &523461484
356+
MonoBehaviour:
357+
m_ObjectHideFlags: 0
358+
m_CorrespondingSourceObject: {fileID: 0}
359+
m_PrefabInstance: {fileID: 0}
360+
m_PrefabAsset: {fileID: 0}
361+
m_GameObject: {fileID: 523461482}
362+
m_Enabled: 1
363+
m_EditorHideFlags: 0
364+
m_Script: {fileID: 11500000, guid: 42c0c71cb5509264ba509531534a69d0, type: 3}
365+
m_Name:
366+
m_EditorClassIdentifier:
367+
sphere: {fileID: 1211809136}
368+
quad: {fileID: 1831773974}
369+
corner1: {fileID: 1770172803}
370+
corner2: {fileID: 1046193073}
371+
corner3: {fileID: 298229497}
354372
--- !u!1 &687075864
355373
GameObject:
356374
m_ObjectHideFlags: 0
@@ -544,7 +562,7 @@ Transform:
544562
m_GameObject: {fileID: 1046193069}
545563
serializedVersion: 2
546564
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
547-
m_LocalPosition: {x: 1.3590554, y: 3.3182793, z: -1.0722584}
565+
m_LocalPosition: {x: -2.1140213, y: -0.00000023841858, z: 1.739898}
548566
m_LocalScale: {x: 1, y: 1, z: 1}
549567
m_ConstrainProportionsScale: 0
550568
m_Children: []
@@ -754,7 +772,7 @@ Transform:
754772
m_GameObject: {fileID: 1770172799}
755773
serializedVersion: 2
756774
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
757-
m_LocalPosition: {x: -1.3585745, y: 3.2813835, z: -4.3110037}
775+
m_LocalPosition: {x: -2.1140213, y: 0.00000020721927, z: -1.739898}
758776
m_LocalScale: {x: 1, y: 1, z: 1}
759777
m_ConstrainProportionsScale: 0
760778
m_Children: []
@@ -859,13 +877,13 @@ Transform:
859877
m_PrefabAsset: {fileID: 0}
860878
m_GameObject: {fileID: 1831773974}
861879
serializedVersion: 2
862-
m_LocalRotation: {x: -0.0018439991, y: -0.42261425, z: 0.003954469, w: 0.90629923}
863-
m_LocalPosition: {x: 0.01, y: 1.56, z: -2.68}
880+
m_LocalRotation: {x: 0.7071068, y: 0, z: 0, w: 0.7071068}
881+
m_LocalPosition: {x: 0, y: 0, z: 0}
864882
m_LocalScale: {x: 4.2280426, y: 3.4797955, z: 1.638}
865883
m_ConstrainProportionsScale: 0
866884
m_Children: []
867885
m_Father: {fileID: 0}
868-
m_LocalEulerAnglesHint: {x: 0, y: -50, z: 0.5}
886+
m_LocalEulerAnglesHint: {x: 90, y: 0, z: 0}
869887
--- !u!1660057539 &9223372036854775807
870888
SceneRoots:
871889
m_ObjectHideFlags: 0
File renamed without changes.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /