Class PhysicsRaycastResult
Hierarchy
- CastingResult
- PhysicsRaycastResult
Constructors
constructor
-
Returns PhysicsRaycastResult
Properties
Optionalbody
The Physics body that the query hit.
Optionalbody Index
bodyIndex?: number
The body Index in case the Physics body is using instances
Optionalshape
The shape hit by the query.
Accessors
has Hit
-
get hasHit(): boolean
Gets if there was a hit
Returns boolean
hit Distance
-
get hitDistance(): number
Gets the distance from the hit
Returns number
hit Normal
-
Gets the hit normal.
Returns Vector3
hit Normal World
-
Gets the hit normal/direction in the world
Returns Vector3
hit Point
-
Gets the hit point.
Returns Vector3
hit Point World
-
Gets the hit point in the world
Returns Vector3
ray From World
-
Gets the ray "start point" of the ray in the world
Returns Vector3
ray To World
-
Gets the ray "end point" of the ray in the world
Returns Vector3
triangle Index
-
get triangleIndex(): number
The index of the original triangle which was hit. Will be -1 if contact point is not on a mesh shape
Returns number
Methods
calculate Hit Distance
-
Calculates the distance manually
Returns void
reset
set Hit Data
-
Sets the hit data
Parameters
- hitNormal: IXYZ
defines the normal in world space
- hitPoint: IXYZ
defines the point in world space
OptionaltriangleIndex: numberdefines the index of the triangle in case of mesh shape
Returns void
- hitNormal: IXYZ
set Hit Distance
-
Sets the distance from the start point to the hit point
Parameters
- distance: number
defines the distance to set
Returns void
- distance: number
Holds the data for the raycast result
See
https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine