CollisionRay

class CollisionRay

Bases: CollisionSolid

An infinite ray, with a specific origin and direction. It begins at its origin and continues in one direction to infinity, and it has no radius. Useful for picking from a window, or for gravity effects.

Inheritance diagram

Inheritance diagram of CollisionRay

CollisionRay(void)
explicit CollisionRay(LPoint3 const &origin, LVector3 const &direction)
explicit CollisionRay(PN_stdfloat ox, PN_stdfloat oy, PN_stdfloat oz, PN_stdfloat dx, PN_stdfloat dy, PN_stdfloat dz)

Creates an invalid ray. This isn’t terribly useful; it’s expected that the user will subsequently adjust the ray via set_origin()/set_direction() or set_from_lens().

static TypeHandle get_class_type(void)
LVector3 const &get_direction(void) const
LPoint3 const &get_origin(void) const
void set_direction(LVector3 const &direction)
void set_direction(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)
bool set_from_lens(LensNode *camera, LPoint2 const &point)
bool set_from_lens(LensNode *camera, PN_stdfloat px, PN_stdfloat py)

Accepts a LensNode and a 2-d point in the range [-1,1]. Sets the CollisionRay so that it begins at the LensNode’s near plane and extends to infinity, making it suitable for picking objects from the screen given a camera and a mouse location.

Accepts a LensNode and a 2-d point in the range [-1,1]. Sets the CollisionRay so that it begins at the LensNode’s near plane and extends to infinity, making it suitable for picking objects from the screen given a camera and a mouse location.

Returns true if the point was acceptable, false otherwise.

void set_origin(LPoint3 const &origin)
void set_origin(PN_stdfloat x, PN_stdfloat y, PN_stdfloat z)