CollisionSegment

from panda3d.core import CollisionSegment
class CollisionSegment

Bases:

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__()

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)
__init__(ax: float, ay: float, az: float, bx: float, by: float, bz: float)
static getClassType() TypeHandle
getPointA() LPoint3
getPointB() LPoint3
property point_a LPoint3

Getter Setter

property point_b LPoint3

Getter Setter

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.

setPointA(a: LPoint3)
setPointA(x: float, y: float, z: float)
setPointB(b: LPoint3)
setPointB(x: float, y: float, z: float)