PhysicsRayCast: Difference between revisions
Jump to navigation
Jump to search
CrosRoad95 (talk | contribs) (Created page with "__NOTOC__ {{Client function}} Perform ray cast between two positions. ==Syntax== <syntaxhighlight lang="lua"> raycast-result physicsRayCast(physics thePhysics, raycast-type...") |
CrosRoad95 (talk | contribs) |
||
Line 21: | Line 21: | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
result = physicsRayCast(physics, "default", 0,0,10, 0,0,0) | |||
if result.hit then | |||
if result.rigidbody ~= false then | |||
print("Rigid body has been hit") | |||
elseif result.staticcollision ~= false then | |||
print("Static collision has been hit") | |||
end | |||
end | |||
</syntaxhighlight> | </syntaxhighlight> | ||
Latest revision as of 13:33, 9 February 2020
Perform ray cast between two positions.
Syntax
raycast-result physicsRayCast(physics thePhysics, raycast-type theType, float startX, float startY, float startZ, float endX, float endY, float endZ, bool filterBackfaces = false )
Required Arguments
- physics: The physics world.
- raycast-type: Type of raycasting, see Physics raycast type
- startXYZ: Start position.
- endXYZ: End position.
- filterBackfaces : Detect hit of backfaces. TODO, tests needed
Returns
- raycast-result raycast result, see Physics raycast type
Example
result = physicsRayCast(physics, "default", 0,0,10, 0,0,0) if result.hit then if result.rigidbody ~= false then print("Rigid body has been hit") elseif result.staticcollision ~= false then print("Static collision has been hit") end end
See Also
- physicsCreateWorld
- physicsDestroy
- physicsCreateShape
- physicsCreateShapeFromModel
- physicsCreateRigidBody
- physicsCreateStaticCollision
- physicsCreateConstraint
- physicsAddChildShape
- physicsRemoveChildShape
- physicsGetChildShapes
- physicsSetChildShapeOffsets
- physicsGetChildShapeOffsets
- physicsGetShapes
- physicsGetRigidBodies
- physicsGetStaticCollisions
- physicsGetConstraints
- physicsSetProperties
- physicsGetProperties
- physicsDrawDebug
- physicsSetDebugMode
- physicsBuildCollisionFromGTA
- physicsApplyVelocity
- physicsApplyVelocityForce
- physicsApplyAngularVelocity
- physicsApplyAngularVelocityForce
- physicsApplyDamping
- physicsRayCast
- physicsShapeCast
- physicsGetElementType
- physicsIsElement