|
|
Line 1: |
Line 1: |
− | The SPhysicsHit struct refers to a single physics hit (usually returned via raycasting)
| + | This page has moved to: https://docs.sine.space/v/scripting/client-scripting/types/sphysicshit |
− | | + | |
− | ==Properties==
| + | |
− | {{ScriptFunction|SGameObject|Object|{ get; }|The object which was hit|5= <pre>this = Space.Host.ExecutingObject
| + | |
− | hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)
| + | |
− | | + | |
− | hitGameObject = hit.Object</pre>}}}
| + | |
− | | + | |
− | {{ScriptFunction|SVector|Position|{ get; }|Where the physics hit occurred|5= <pre>this = Space.Host.ExecutingObject
| + | |
− | hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)
| + | |
− | | + | |
− | hitPosition = hit.Position</pre>}}}
| + | |
− | | + | |
− | {{ScriptFunction|SVector|Normal|{ get; }|The normal of the hit|5= <pre>this = Space.Host.ExecutingObject
| + | |
− | hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)
| + | |
− | | + | |
− | hitNormal = hit.Normal</pre>}}}
| + | |
− | | + | |
− | {{ScriptFunction|SVector|UV|{ get; }|The UV coordinates of where the hit occurred on a mesh|5= <pre>this = Space.Host.ExecutingObject
| + | |
− | hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)
| + | |
− | | + | |
− | hitUV = hit.UV</pre>}}}
| + | |
− | | + | |
− | {{ScriptFunction|SVector|UV2|{ get; }|The UV2 coordinates of where the hit occurred on a mesh|5= <pre>this = Space.Host.ExecutingObject
| + | |
− | hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)
| + | |
− | | + | |
− | hitUV2 = hit.UV2</pre>}}}
| + | |
− | | + | |
− | {{ScriptFunction|float|Distance|{ get; }|How far down a ray or from the collider, the hit occurred|5= <pre>this = Space.Host.ExecutingObject
| + | |
− | hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)
| + | |
− | | + | |
− | hitDistance = hit.Distance</pre>}}}
| + | |
− | | + | |
− | {{ScriptFunction|bool|ContainsHit|{ get; }|Whether it was a hit or not|5= <pre>this = Space.Host.ExecutingObject
| + | |
− | hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)
| + | |
− | | + | |
− | hitContainsHit = hit.ContainsHit</pre>}}
| + | |
− | | + | |
− | | + | |
− | {{Scripting Navbox}}
| + | |