Breakroom is now Sinewave Campus. Book a meeting

SPhysicsHit

ClientTypes
On this classObject
  1. Properties
  2. Object
  3. Position
  4. Normal
  5. UV
  6. UV2
  7. Distance
  8. ContainsHit
Members 7
PropertyObject–
PropertyPositionWhere the physics hit occurred
PropertyNormalThe normal of the hit
PropertyUVThe UV coordinates of where the hit occurred on a mesh.
PropertyUV2The UV2 coordinates of where the hit occurred on a mesh.
PropertyDistanceHow far down a ray or from the collider, the hit occurred
PropertyContainsHitWhether it was a hit or not

Properties​

ObjectRead only​

SGameObject Object {get; }

Example

Lua
this = Space.Host.ExecutingObject
hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)

hitGameObject = hit.Object
Lua
example 2

PositionRead only​

SVector Position {get; }

Where the physics hit occurred

Example

Lua
this = Space.Host.ExecutingObject
hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)

hitPosition = hit.Position

NormalRead only​

SVector Normal {get; }

The normal of the hit

Example

Lua
this = Space.Host.ExecutingObject
hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)

hitNormal = hit.Normal

UVRead only​

SVector UV {get; }

The UV coordinates of where the hit occurred on a mesh.

Example

Lua
this = Space.Host.ExecutingObject
hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)

hitUV = hit.UV

UV2Read only​

SVector UV2 {get; }

The UV2 coordinates of where the hit occurred on a mesh.

Example

Lua
this = Space.Host.ExecutingObject
hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)

hitUV2 = hit.UV2

DistanceRead only​

float Distance {get; }

How far down a ray or from the collider, the hit occurred

Example

Lua
this = Space.Host.ExecutingObject
hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)

hitDistance = hit.Distance

ContainsHitRead only​

bool ContainsHit {get; }

Whether it was a hit or not

Example

Lua
this = Space.Host.ExecutingObject
hit = Space.Physics.RayCastSingle(this.WorldPosition,this.Forward,20)

hitContainsHit = hit.ContainsHit