panda3d.core.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

__init__() → None

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

__init__(origin: LPoint3, direction: LVector3) → None
__init__(ox: float, oy: float, oz: float, dx: float, dy: float, dz: float) → None
setOrigin(origin: LPoint3) → None
setOrigin(x: float, y: float, z: float) → None
getOrigin() → LPoint3
Return type

LPoint3

setDirection(direction: LVector3) → None
setDirection(x: float, y: float, z: float) → None
getDirection() → LVector3
Return type

LVector3

setFromLens(camera: LensNode, point: LPoint2) → bool

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.

setFromLens(camera: LensNode, px: float, py: float) → bool

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.

static getClassType() → TypeHandle
Return type

TypeHandle

property origin

Getter Setter

Return type

LPoint3

property direction

Getter Setter

Return type

LVector3