(Created page with "The SPhysicsHit struct refers to a single physics hit (usually returned via raycasting) ==Fields== {{ScriptFunction|SGameObject|Object|{ get; }|The object which was hit}} {{S...") |
(Added and defined 1 property + Added simple examples to 7 properties) |
||
Line 1: | Line 1: | ||
The SPhysicsHit struct refers to a single physics hit (usually returned via raycasting) | The SPhysicsHit struct refers to a single physics hit (usually returned via raycasting) | ||
− | == | + | ==Properties== |
− | {{ScriptFunction|SGameObject|Object|{ get; }|The object which was hit}} | + | {{ScriptFunction|SGameObject|Object|{ get; }|The object which was hit|5= <pre>this = Space.Host.ExecutingObject |
− | {{ScriptFunction|SVector|Position|{ get; }|Where the physics hit occurred}} | + | hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20) |
− | {{ScriptFunction|SVector|Normal|{ get; }|The normal of the hit}} | + | |
− | {{ScriptFunction|SVector|UV|{ get; }|The UV coordinates of where the hit | + | hitGameObject = hit.Object</pre>}}} |
− | {{ScriptFunction|SVector|UV2|{ get; }|The UV2 coordinates of where the hit | + | |
− | {{ScriptFunction|float|Distance|{ get; }|How far down a ray or from the collider, the hit | + | {{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}} | {{Scripting Navbox}} |
The SPhysicsHit struct refers to a single physics hit (usually returned via raycasting)
The object which was hit
this = Space.Host.ExecutingObject hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20) hitGameObject = hit.Object
Where the physics hit occurred
this = Space.Host.ExecutingObject hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20) hitPosition = hit.Position
The normal of the hit
this = Space.Host.ExecutingObject hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20) hitNormal = hit.Normal
The UV coordinates of where the hit occurred on a mesh
this = Space.Host.ExecutingObject hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20) hitUV = hit.UV
The UV2 coordinates of where the hit occurred on a mesh
this = Space.Host.ExecutingObject hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20) hitUV2 = hit.UV2
How far down a ray or from the collider, the hit occurred
this = Space.Host.ExecutingObject hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20) hitDistance = hit.Distance
Whether it was a hit or not
this = Space.Host.ExecutingObject hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20) hitContainsHit = hit.ContainsHit
|