Basic Features XPresso XPresso Nodes General Ray Operator
Function available in CINEMA 4D Prime, Visualize, Broadcast, Studio & BodyPaint 3D
Ray Operator

Basic Node Parameter

Parameter

Object

Here, connect the polygon object that you want to fire the ray at.

Ray Point1 [XYZ ]
Ray Point2 [XYZ ]

The ray is defined by two points. The vector between these two points represents the ray. Ray Point1 defines the starting position of the ray, Ray Point2 its end position. These two points enable you to define not only the direction of the ray, but its length also.

In the example above, a ray is generated between the two triangles. In the event of a collision, a sphere will be placed at the point the ray hits the object.

Collision

This port signals whether the ray has hit the object. A Boole value of 1 indicates a collision, a Boole value of 0 means the ray missed the object.

Hit Position [XYZ ]

Outputs the position where the ray first hit the object (recall that the ray travels from Ray Point 1 to Ray Point2). This vector can only be calculated if a collision has taken place. To switch on this port, in the Attribute Manager, disable Test Only. The Hit Position is given in either local or global coordinates, depending on whether Global Coordinates is enabled in the Attribute Manager.

Face Index [-2147483648..2147483647]

If a collision has taken place, this port outputs the index number of the first polygon hit by the ray. To switch on this port, in the Attribute Manager, disable Test Only.

Face Normal

If the ray has hit a surface, this port outputs the normal of the polygon hit. To switch on this port, in the Attribute Manager, disable Only Test.

Phong Normal

In contrast to Face Normal, this port’s output depends on the Normals of the polygons that surround the polygon hit by the ray. To switch on this port, in the Attribute Manager, disable Only Test.

Distance [-∞..+∞]

If the ray has hit a polygon, this port outputs the distance from Ray Point1 to the polygon first hit by the ray. To switch on this port, in the Attribute Manager, disable Test Only.

Is Backface

This port outputs a Boole value that indicates whether the ray hit a backface (output is 1) or a frontface (output is 0). Note that the direction of the polygon’s surface normal determines which side is the front and which is the back.