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
- __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()
.
- static get_class_type() TypeHandle
- set_from_lens(camera: LensNode, point: LPoint2) bool
Accepts a
LensNode
and a 2-d point in the range [-1,1]. Sets theCollisionSegment
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 theCollisionSegment
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.