RayCast3DPhysicsObject

Family: 3DPhysics · One form

What it does

RayCast3DPhysicsObject takes objID (an integer), rayID (an integer), fromVec3ID (an integer), toVec3ID (an integer) and allOrClosest (an integer), and answers an integer. objID is the id of a 3D object, the one LoadObject returned: it is how the call knows what to act on.

Syntax

RayCast3DPhysicsObject(objID integer, rayID integer, fromVec3ID integer, toVec3ID integer, allOrClosest integer) → integer

Parameters

NameType
objIDinteger
rayIDinteger
fromVec3IDinteger
toVec3IDinteger
allOrClosestinteger

Every form returns

integer

Example · generated

object = LoadObject("assets/media.obj")ray = Create3DPhysicsRay()DO  Print(RayCast3DPhysicsObject(object, ray, 1, 1, 1))  Sync()LOOP

LoadObject and Create3DPhysicsRay are there to give the call something to act on; RayCast3DPhysicsObject is the line that matters. The DO … LOOP is not decoration: a classic BASIC program ends the moment it runs out of lines, and Sync() is what draws the frame.

Related commands

144 commands in 3DPhysics