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 set_from_lens().

__init__(a: LPoint3, db: LPoint3)
__init__(ax: float, ay: float, az: float, bx: float, by: float, bz: float)
static get_class_type() TypeHandle
get_point_a() LPoint3
get_point_b() LPoint3
property point_a LPoint3

Getter Setter

property point_b LPoint3

Getter Setter

set_from_lens(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.

set_from_lens(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.

set_point_a(a: LPoint3)
set_point_a(x: float, y: float, z: float)
set_point_b(b: LPoint3)
set_point_b(x: float, y: float, z: float)