panda3d.core.CollisionSegment

class CollisionSegment

Bases: CollisionSolid

A finite line segment, with two specific endpoints but no thickness. It’s similar to a CollisionRay, except it does not continue to infinity.

It does have an ordering, from point A to point B. If more than a single point of the segment is intersecting a solid, the reported intersection point is generally the closest on the segment to point A.

Inheritance diagram

Inheritance diagram of CollisionSegment

__init__() → None

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

__init__(a: LPoint3, db: LPoint3) → None
__init__(ax: float, ay: float, az: float, bx: float, by: float, bz: float) → None
setPointA(a: LPoint3) → None
setPointA(x: float, y: float, z: float) → None
getPointA() → LPoint3
Return type

LPoint3

setPointB(b: LPoint3) → None
setPointB(x: float, y: float, z: float) → None
getPointB() → LPoint3
Return type

LPoint3

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

Accepts a LensNode and a 2-d point in the range [-1,1]. Sets the CollisionSegment so that it begins at the LensNode’s near plane and extends to the far plane, 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 CollisionSegment so that it begins at the LensNode’s near plane and extends to the far plane, making it suitable for picking objects from the screen given a camera and a mouse location.

static getClassType() → TypeHandle
Return type

TypeHandle

property point_a

Getter Setter

Return type

LPoint3

property point_b

Getter Setter

Return type

LPoint3