42 nassertv(_error_type == ET_ok);
45 ptr()->getActor().releaseShape(*ptr());
52 factory(NxShapeType shapeType) {
65 case NX_SHAPE_CAPSULE:
74 case NX_SHAPE_HEIGHTFIELD:
81 physx_cat.error() <<
"Unknown shape type.\n";
91 nassertr(_error_type == ET_ok,
nullptr);
92 return (
PhysxActor *)(ptr()->getActor().userData);
102 nassertv(_error_type == ET_ok);
104 _name = name ? name :
"";
105 ptr()->setName(_name.c_str());
114 nassertr(_error_type == ET_ok,
"");
115 return ptr()->getName();
132 nassertv(_error_type == ET_ok);
134 ptr()->setFlag((NxShapeFlag)flag, value);
143 nassertr(_error_type == ET_ok,
false);
145 return (ptr()->getFlag((NxShapeFlag)flag)) ? true :
false;
154 nassertv(_error_type == ET_ok);
155 nassertv(skinWidth >= 0.0f);
157 ptr()->setSkinWidth(skinWidth);
166 nassertr(_error_type == ET_ok, 0.0f);
168 return ptr()->getSkinWidth();
181 nassertv(_error_type == ET_ok);
182 nassertv(group < 32);
184 ptr()->setGroup(group);
194 nassertr(_error_type == ET_ok, 0);
196 return ptr()->getGroup();
212 nassertv(_error_type == ET_ok);
224 nassertr(_error_type == ET_ok, LPoint3f::zero());
242 nassertv(_error_type == ET_ok);
254 nassertr(_error_type == ET_ok, LMatrix4f::zeros_mat());
265 nassertr(_error_type == ET_ok, 0);
266 NxMaterialIndex index = ptr()->getMaterial();
267 return (
unsigned int)index;
276 nassertv(_error_type == ET_ok);
277 ptr()->setMaterial(material.ptr()->getMaterialIndex());
291 nassertv(_error_type == ET_ok);
292 ptr()->setMaterial((NxMaterialIndex)index);
302 nassertv(_error_type == ET_ok);
303 ptr()->setGroupsMask(mask.get_mask());
313 nassertr(_error_type == ET_ok, mask);
314 mask.set_mask(ptr()->getGroupsMask());
325 nassertr(_error_type == ET_ok, bounds);
326 ptr()->getWorldBounds(bounds._bounds);
336 nassertr(_error_type == ET_ok,
false);
337 return ptr()->checkOverlapAABB(world_bounds._bounds);
346 nassertr(_error_type == ET_ok,
false);
347 return ptr()->checkOverlapCapsule(world_capsule._capsule);
356 nassertr(_error_type == ET_ok,
false);
357 return ptr()->checkOverlapOBB(world_box._box);
366 nassertr(_error_type == ET_ok,
false);
367 return ptr()->checkOverlapSphere(world_sphere._sphere);
374 raycast(
const PhysxRay &worldRay,
bool firstHit,
bool smoothNormal)
const {
377 nassertr(_error_type == ET_ok, hit);
379 NxU32 hints = NX_RAYCAST_SHAPE | NX_RAYCAST_IMPACT | NX_RAYCAST_DISTANCE;
380 if (smoothNormal ==
true) {
381 hints |= NX_RAYCAST_NORMAL;
384 hints |= NX_RAYCAST_FACE_NORMAL;
387 ptr()->raycast(worldRay._ray, worldRay._length, hints, hit, firstHit);
397 nassertv(_error_type == ET_ok);
399 ptr()->setCCDSkeleton(skel->ptr());
407 get_ccd_skeleton()
const {
409 nassertr(_error_type == ET_ok,
nullptr);
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
unsigned short get_material_index() const
Returns the material index currently assigned to the shape.
PhysxActor * get_actor() const
Retrieves the actor which this shape is associated with.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Represents a sphere defined by its center point and radius.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void set_group(unsigned short group)
Sets which collision group this shape is part of.
void set_local_mat(const LMatrix4f &mat)
Set the transform of the shape in actor space, i.e.
bool check_overlap_obb(const PhysxBox &world_box) const
Checks whether the shape overlaps a world-space OBB or not.
Represents an oriented bounding box, as a center point, extents(radii) and a rotation.
static NxVec3 point3_to_nxVec3(const LPoint3f &p)
Converts from LPoint3f to NxVec3.
unsigned short get_group() const
Retrieves the collision group set for this shape.
Abstract base class for shapes.
This class is a shape instance of a height field object of type PhysxHeightField.
Represention of a axis aligned bounding box.
const char * get_name() const
Returns the name string.
A plane collision detection primitive.
A sphere shaped collision detection primitive.
bool check_overlap_aabb(const PhysxBounds3 &world_bounds) const
Checks whether the shape overlaps a world-space AABB or not.
void set_flag(const PhysxShapeFlag flag, bool value)
Sets the specified shape flag.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A class for describing a shape's surface properties.
static NxMat34 mat4_to_nxMat34(const LMatrix4f &m)
Converts from LMatrix4f to NxMat34.
LMatrix4f get_local_mat() const
Retrieve the transform of the shape in actor space, i.e.
void set_material(const PhysxMaterial &material)
Assigns a material to the shape.
void set_local_pos(const LPoint3f &pos)
Set the position of the shape in actor space, i.e.
This structure captures results for a single raycast query.
void set_skin_width(float skinWidth)
Sets the skin width.
bool check_overlap_sphere(const PhysxSphere &world_sphere) const
Checks whether the shape overlaps a world-space sphere or not.
bool check_overlap_capsule(const PhysxCapsule &world_capsule) const
Checks whether the shape overlaps a world-space capsule or not.
float get_skin_width() const
Returns the skin width.
A box shaped collision detection primitive.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A special shape used for simulating a car wheel.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Actors are the main simulation objects.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void set_material_index(unsigned short idx)
Assigns a material index to the shape.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A shapes which is used to represent an instance of an convex mesh.
void set_name(const char *name)
Sets a name string for this object.
LPoint3f get_local_pos() const
Retrieve the position of the shape in actor space, i.e.
void set_groups_mask(const PhysxGroupsMask &mask)
Sets 128-bit mask used for collision filtering.
static LPoint3f nxVec3_to_point3(const NxVec3 &p)
Converts from NxVec3 to LPoint3f.
PhysxBounds3 get_world_bounds() const
Returns a world space AABB enclosing this shape.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool get_flag(const PhysxShapeFlag flag) const
Returns the specified shape flag.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
static LMatrix4f nxMat34_to_mat4(const NxMat34 &m)
Converts from NxMat34 to LMatrix4f.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A capsule shaped collision detection primitive, also known as a line swept sphere.
PhysxGroupsMask get_groups_mask() const
Gets 128-bit mask used for collision filtering.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Represents an ray as an origin and direction.
A shapes which is used to represent an instance of an convex mesh.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.