cast a ray and test intersection with physics bodies
summary (oneliner)
Cast Ray allows you to pick 3d objects that are defined in your physics world (Ops.Physics.World).
One use case may be a 3D menu, where your buttons are cube meshes with physics cubes (Ops.Physics.Body.PhysicsCube_v2) placed in the same exact location.
With Cast Ray placed in your physics world, you will be able to test when a mouse cursor intersects with one of the cubes, allowing you to use the cube as a button.
When using a Mouse OP with CastRay to pick your physics objects, make sure to directly plug in your Mouse op X/Y into the CastRay op and turn on Normalize in the Mouse OP.
doc
issues
youtube id
caniuse query
collections
Inputs
Trigger in
Position of the ray on the X axis 0.0 is the center of the screen
Position of the ray on the Y axis 0.0 is the center of the screen
Position of the ray on the Z axis 0.0 is the center of the screen
Outputs
Trigger out
if the ray intersects/hits a physics body then 1 is output
Intersection position in world space on the X axis
Intersection position in world space on the Y axis
Intersection position in world space on the Z axis
which normal was picked on the object on X axis (-1,0,1)
which normal was picked on the object on Y axis (-1,0,1)
which normal was picked on the object on Z axis (-1,0,1)
object containing all parameter information and some extras, inspect to see which ones are available to parse out
location of picked physics body on X axis
location of picked physics body on Y axis
location of picked physics body on Z axis
name and number of picked object - Name is set in a physics body operator and the number is assigned after it with a ".#" format
Changelog
2019-02-12 - pandur
Ops.Exp.Gl.Physics.CastRay renamed to Ops.Physics.CastRay
2020-07-30 - pandur