# CollisionSegment

from pandac.PandaModules import CollisionSegment

Class : CollisionSegment
Description : 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:

CollisionSegment: CollisionSolid
CollisionSolid: CopyOnWriteObject
CopyOnWriteObject: CachedTypedWritableReferenceCount
CachedTypedWritableReferenceCount: TypedWritableReferenceCount
TypedWritableReferenceCount: TypedWritable ReferenceCount
TypedWritable: TypedObject
TypedObject: MemoryBase
MemoryBase:
ReferenceCount: MemoryBase

## Methods of CollisionSegment:

CollisionSegment (Constructor)
getClassType
getPointA
getPointB
setFromLens
setPointA
setPointB

## Methods of CollisionSolid:

clearEffectiveNormal
getBounds
getClassType
getCollisionOrigin
getEffectiveNormal
getRespectEffectiveNormal
hasEffectiveNormal
isTangible
output
setBounds
setEffectiveNormal
setRespectEffectiveNormal
setTangible
write

## Methods of CopyOnWriteObject:

cacheRef
getClassType
unref

## Methods of CachedTypedWritableReferenceCount:

cacheRef
cacheUnref
getCacheRefCount
getClassType
testRefCountIntegrity

## Methods of TypedWritableReferenceCount:

getClassType

## Methods of TypedWritable:

getClassType

## Methods of TypedObject:

getClassType
getType
getTypeIndex
isExactType
isOfType

## Methods of ReferenceCount:

getClassType
getRefCount
ref
testRefCountIntegrity
testRefCountNonzero
unref

CollisionSegment CollisionSegment::CollisionSegment(void); Description: 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(). Description:

getClassType static TypeHandle CollisionSegment::get_class_type(void); Undocumented function.

getPointA LPoint3f const &CollisionSegment::get_point_a(void) const; Description:

getPointB LPoint3f const &CollisionSegment::get_point_b(void) const; Description:

setFromLens bool CollisionSegment::set_from_lens(LensNode *camera, LPoint2f const &point); Description: 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.

setPointA void CollisionSegment::set_point_a(LPoint3f const &a); Description:

setPointB void CollisionSegment::set_point_b(LPoint3f const &b); Description:

clearEffectiveNormal void CollisionSolid::clear_effective_normal(void); Description: Removes the normal previously set by set_effective_normal().

getBounds ConstPointerTo< BoundingVolume > CollisionSolid::get_bounds(void) const; Description: Returns the solid's bounding volume.

getClassType static TypeHandle CollisionSolid::get_class_type(void); Undocumented function.

getCollisionOrigin virtual LPoint3f CollisionSolid::get_collision_origin(void) const = 0; Undocumented function.

getEffectiveNormal LVector3f const &CollisionSolid::get_effective_normal(void) const; Description: Returns the normal that was set by set_effective_normal(). It is an error to call this unless has_effective_normal() returns true.

getRespectEffectiveNormal bool CollisionSolid::get_respect_effective_normal(void) const; Description: See set_respect_effective_normal().

hasEffectiveNormal bool CollisionSolid::has_effective_normal(void) const; Description: Returns true if a special normal was set by set_effective_normal(), false otherwise.

isTangible bool CollisionSolid::is_tangible(void) const; Description: Returns whether the solid is considered 'tangible' or not. An intangible solid has no effect in a CollisionHandlerPusher (except to throw an event); it's useful for defining 'trigger' planes and spheres, that cause an effect when passed through.

output virtual void CollisionSolid::output(ostream &out) const; Description:

setBounds void CollisionSolid::set_bounds(BoundingVolume const &bounding_volume); Description: Returns the solid's bounding volume.

setEffectiveNormal void CollisionSolid::set_effective_normal(LVector3f const &effective_normal); Description: Records a false normal for this CollisionSolid that will be reported by the collision system with all collisions into it, instead of its actual normal. This is useful as a workaround for the problem of an avatar wanting to stand on a sloping ground; by storing a false normal, the ground appears to be perfectly level, and the avatar does not tend to slide down it.

setRespectEffectiveNormal void CollisionSolid::set_respect_effective_normal(bool respect_effective_normal); Description: This is only meaningful for CollisionSolids that will be added to a traverser as colliders. It is normally true, but if set false, it means that this particular solid does not care about the "effective" normal of other solids it meets, but rather always uses the true normal.

setTangible void CollisionSolid::set_tangible(bool tangible); Description: Sets the current state of the 'tangible' flag. Set this true to make the solid tangible, so that a CollisionHandlerPusher will not allow another object to intersect it, or false to make it intangible, so that a CollisionHandlerPusher will ignore it except to throw an event.

write virtual void CollisionSolid::write(ostream &out, int indent_level = (0)) const; Description:

cacheRef void CopyOnWriteObject::cache_ref(void) const; Description: See CachedTypedWritableReferenceCount::cache_ref().

getClassType static TypeHandle CopyOnWriteObject::get_class_type(void); Undocumented function.

unref bool CopyOnWriteObject::unref(void) const; Description: Explicitly decrements the reference count. See ReferenceCount::unref(). In the case of a CopyOnWriteObject, when the reference count decrements down to the cache reference count, the object is implicitly unlocked.

cacheRef void CachedTypedWritableReferenceCount::cache_ref(void) const; Description: Explicitly increments the cache reference count and the normal reference count simultaneously.

cacheUnref bool CachedTypedWritableReferenceCount::cache_unref(void) const; Description: Explicitly decrements the cache reference count and the normal reference count simultaneously. The return value is true if the new reference count is nonzero, false if it is zero.

getCacheRefCount int CachedTypedWritableReferenceCount::get_cache_ref_count(void) const; Description: Returns the current reference count.

getClassType static TypeHandle CachedTypedWritableReferenceCount::get_class_type(void); Undocumented function.

testRefCountIntegrity bool CachedTypedWritableReferenceCount::test_ref_count_integrity(void) const; Description: Does some easy checks to make sure that the reference count isn't completely bogus.

getClassType static TypeHandle TypedWritableReferenceCount::get_class_type(void); Undocumented function.

getClassType static TypeHandle TypedWritable::get_class_type(void); Undocumented function.

getClassType static TypeHandle TypedObject::get_class_type(void); Undocumented function.

getType virtual TypeHandle TypedObject::get_type(void) const = 0; Derived classes should override this function to return get_class_type().

getTypeIndex int TypedObject::get_type_index(void) const; Description: Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. This is equivalent to get_type().get_index().

isExactType bool TypedObject::is_exact_type(TypeHandle handle) const; Description: Returns true if the current object is the indicated type exactly.

isOfType bool TypedObject::is_of_type(TypeHandle handle) const; Description: Returns true if the current object is or derives from the indicated type.

getClassType static TypeHandle ReferenceCount::get_class_type(void); Undocumented function.

getRefCount int ReferenceCount::get_ref_count(void) const; Description: Returns the current reference count.

ref void ReferenceCount::ref(void) const; Description: Explicitly increments the reference count. User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.

testRefCountIntegrity bool ReferenceCount::test_ref_count_integrity(void) const; Description: Does some easy checks to make sure that the reference count isn't completely bogus. Returns true if ok, false otherwise.

testRefCountNonzero bool ReferenceCount::test_ref_count_nonzero(void) const; Description: Does some easy checks to make sure that the reference count isn't zero, or completely bogus. Returns true if ok, false otherwise.

unref bool ReferenceCount::unref(void) const; Description: Explicitly decrements the reference count. Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic; plus, we don't have a virtual destructor anyway.) However, see the helper function unref_delete(). User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically. This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it. The return value is true if the new reference count is nonzero, false if it is zero.