Panda3D
|
Abstract base class for shapes. More...
#include "physxShape.h"
Public Member Functions | |
bool | check_overlap_aabb (const PhysxBounds3 &world_bounds) const |
Checks whether the shape overlaps a world-space AABB or not. | |
bool | check_overlap_capsule (const PhysxCapsule &world_capsule) const |
Checks whether the shape overlaps a world-space capsule or not. | |
bool | check_overlap_obb (const PhysxBox &world_box) const |
Checks whether the shape overlaps a world-space OBB or not. | |
bool | check_overlap_sphere (const PhysxSphere &world_sphere) const |
Checks whether the shape overlaps a world-space sphere or not. | |
virtual TypeHandle | force_init_type () |
PhysxActor * | get_actor () const |
Retrieves the actor which this shape is associated with. | |
bool | get_flag (const PhysxShapeFlag flag) const |
Returns the specified shape flag. | |
unsigned short | get_group () const |
Retrieves the collision group set for this shape. | |
PhysxGroupsMask | get_groups_mask () const |
Gets 128-bit mask used for collision filtering. | |
LMatrix4f | get_local_mat () const |
Retrieve the transform of the shape in actor space, i.e. | |
LPoint3f | get_local_pos () const |
Retrieve the position of the shape in actor space, i.e. | |
unsigned short | get_material_index () const |
Returns the material index currently assigned to the shape. | |
const char * | get_name () const |
Returns the name string. | |
float | get_skin_width () const |
Returns the skin width. | |
virtual TypeHandle | get_type () const |
PhysxBounds3 | get_world_bounds () const |
Returns a world space AABB enclosing this shape. | |
virtual void | link (NxShape *shapePtr)=0 |
void | ls () const |
void | ls (ostream &out, int indent_level=0) const |
virtual NxShape * | ptr () const =0 |
PhysxRaycastHit | raycast (const PhysxRay &worldRay, bool firstHit, bool smoothNormal) const |
void | release () |
void | set_flag (const PhysxShapeFlag flag, bool value) |
Sets the specified shape flag. | |
void | set_group (unsigned short group) |
Sets which collision group this shape is part of. | |
void | set_groups_mask (const PhysxGroupsMask &mask) |
Sets 128-bit mask used for collision filtering. | |
void | set_local_mat (const LMatrix4f &mat) |
Set the transform of the shape in actor space, i.e. | |
void | set_local_pos (const LPoint3f &pos) |
Set the position of the shape in actor space, i.e. | |
void | set_material (const PhysxMaterial &material) |
Assigns a material to the shape. | |
void | set_material_index (unsigned short idx) |
Assigns a material index to the shape. | |
void | set_name (const char *name) |
Sets a name string for this object. | |
void | set_skin_width (float skinWidth) |
Sets the skin width. | |
virtual void | unlink ()=0 |
Static Public Member Functions | |
static PhysxShape * | factory (NxShapeType shapeType) |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. |
Abstract base class for shapes.
Definition at line 40 of file physxShape.h.
bool PhysxShape::check_overlap_aabb | ( | const PhysxBounds3 & | world_bounds | ) | const |
Checks whether the shape overlaps a world-space AABB or not.
Definition at line 396 of file physxShape.cxx.
bool PhysxShape::check_overlap_capsule | ( | const PhysxCapsule & | world_capsule | ) | const |
Checks whether the shape overlaps a world-space capsule or not.
Definition at line 409 of file physxShape.cxx.
bool PhysxShape::check_overlap_obb | ( | const PhysxBox & | world_box | ) | const |
Checks whether the shape overlaps a world-space OBB or not.
Definition at line 422 of file physxShape.cxx.
bool PhysxShape::check_overlap_sphere | ( | const PhysxSphere & | world_sphere | ) | const |
Checks whether the shape overlaps a world-space sphere or not.
Definition at line 435 of file physxShape.cxx.
PhysxActor * PhysxShape::get_actor | ( | ) | const |
Retrieves the actor which this shape is associated with.
Definition at line 96 of file physxShape.cxx.
bool PhysxShape::get_flag | ( | const PhysxShapeFlag | flag | ) | const |
Returns the specified shape flag.
Definition at line 161 of file physxShape.cxx.
unsigned short PhysxShape::get_group | ( | ) | const |
Retrieves the collision group set for this shape.
The collision group is an integer between 0 and 31.
Definition at line 224 of file physxShape.cxx.
PhysxGroupsMask PhysxShape::get_groups_mask | ( | ) | const |
Gets 128-bit mask used for collision filtering.
Definition at line 367 of file physxShape.cxx.
LMatrix4f PhysxShape::get_local_mat | ( | ) | const |
Retrieve the transform of the shape in actor space, i.e.
relative to the actor it is owned by.
Definition at line 296 of file physxShape.cxx.
References PhysxManager::nxMat34_to_mat4(), and LMatrix4f::zeros_mat().
LPoint3f PhysxShape::get_local_pos | ( | ) | const |
Retrieve the position of the shape in actor space, i.e.
relative to the actor it is owned by.
Definition at line 260 of file physxShape.cxx.
References PhysxManager::nxVec3_to_point3(), and LPoint3f::zero().
unsigned short PhysxShape::get_material_index | ( | ) | const |
Returns the material index currently assigned to the shape.
Definition at line 310 of file physxShape.cxx.
const char * PhysxShape::get_name | ( | ) | const |
Returns the name string.
Definition at line 125 of file physxShape.cxx.
float PhysxShape::get_skin_width | ( | ) | const |
Returns the skin width.
Definition at line 189 of file physxShape.cxx.
PhysxBounds3 PhysxShape::get_world_bounds | ( | ) | const |
Returns a world space AABB enclosing this shape.
Definition at line 381 of file physxShape.cxx.
static void PhysxShape::init_type | ( | ) | [inline, static] |
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Making it inline seems to cause problems in the optimizer.
Reimplemented from PhysxObject.
Reimplemented in PhysxWheelShape, PhysxPlaneShape, PhysxCapsuleShape, PhysxSphereShape, PhysxBoxShape, PhysxHeightFieldShape, PhysxConvexShape, and PhysxTriangleMeshShape.
Definition at line 95 of file physxShape.h.
References PhysxObject::init_type().
Referenced by PhysxConvexShape::init_type(), PhysxTriangleMeshShape::init_type(), PhysxHeightFieldShape::init_type(), PhysxBoxShape::init_type(), PhysxSphereShape::init_type(), PhysxCapsuleShape::init_type(), PhysxPlaneShape::init_type(), and PhysxWheelShape::init_type().
void PhysxShape::set_flag | ( | const PhysxShapeFlag | flag, |
bool | value | ||
) |
Sets the specified shape flag.
The shape may be turned into a trigger by setting one or more of the TriggerFlags to true. A trigger shape will not collide with other shapes. Instead, if a shape enters the trigger's volume, a trigger event will be sent. Trigger events can be listened to by DirectObjects. The following trigger events can be sent:
Definition at line 148 of file physxShape.cxx.
void PhysxShape::set_group | ( | unsigned short | group | ) |
Sets which collision group this shape is part of.
Default group is 0. Maximum possible group is 31. Collision groups are sets of shapes which may or may not be set to collision detect with each other; this can be set using PhysxScene::set_group_collision_flag().
Definition at line 208 of file physxShape.cxx.
void PhysxShape::set_groups_mask | ( | const PhysxGroupsMask & | mask | ) |
Sets 128-bit mask used for collision filtering.
Does NOT wake the associated actor up automatically.
Definition at line 355 of file physxShape.cxx.
void PhysxShape::set_local_mat | ( | const LMatrix4f & | mat | ) |
Set the transform of the shape in actor space, i.e.
relative to the actor it is owned by.
Calling this method does NOT wake the associated actor up automatically.
Calling this method does not automatically update the inertia properties of the owning actor (if applicable); use PhysxActor::update_mass_from_shapes() to do this.
Definition at line 282 of file physxShape.cxx.
References PhysxManager::mat4_to_nxMat34().
void PhysxShape::set_local_pos | ( | const LPoint3f & | pos | ) |
Set the position of the shape in actor space, i.e.
relative to the actor it is owned by.
Calling this method does NOT wake the associated actor up automatically.
Calling this method does not automatically update the inertia properties of the owning actor (if applicable); use PhysxActor::update_mass_from_shapes() to do this.
Definition at line 246 of file physxShape.cxx.
References PhysxManager::point3_to_nxVec3().
void PhysxShape::set_material | ( | const PhysxMaterial & | material | ) |
Assigns a material to the shape.
Definition at line 323 of file physxShape.cxx.
void PhysxShape::set_material_index | ( | unsigned short | index | ) |
Assigns a material index to the shape.
The material index can be retrieved by calling PhysxMaterial::get_material_index(). If the material index is invalid, it will still be recorded, but the default material (at index 0) will effectively be used for simulation.
Definition at line 341 of file physxShape.cxx.
void PhysxShape::set_name | ( | const char * | name | ) |
Sets a name string for this object.
The name can be retrieved again with get_name(). This is for debugging and is not used by the physics engine.
Definition at line 111 of file physxShape.cxx.
void PhysxShape::set_skin_width | ( | float | skinWidth | ) |
Sets the skin width.
The skin width must be non-negative.
Definition at line 175 of file physxShape.cxx.