Go to the documentation of this file.
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);
bool check_overlap_capsule(const PhysxCapsule &world_capsule) const
Checks whether the shape overlaps a world-space capsule or not.
A capsule shaped collision detection primitive, also known as a line swept sphere.
void set_material(const PhysxMaterial &material)
Assigns a material to the shape.
A box shaped collision detection primitive.
static NxVec3 point3_to_nxVec3(const LPoint3f &p)
Converts from LPoint3f to NxVec3.
void set_skin_width(float skinWidth)
Sets the skin width.
Actors are the main simulation objects.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
float get_skin_width() const
Returns the skin width.
This class is a shape instance of a height field object of type PhysxHeightField.
bool check_overlap_sphere(const PhysxSphere &world_sphere) const
Checks whether the shape overlaps a world-space sphere or not.
LPoint3f get_local_pos() const
Retrieve the position of the shape in actor space, i.e.
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.
void set_groups_mask(const PhysxGroupsMask &mask)
Sets 128-bit mask used for collision filtering.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A plane collision detection primitive.
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.
void set_name(const char *name)
Sets a name string for this object.
Represents a sphere defined by its center point and radius.
static LMatrix4f nxMat34_to_mat4(const NxMat34 &m)
Converts from NxMat34 to LMatrix4f.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Represention of a axis aligned bounding box.
PhysxBounds3 get_world_bounds() const
Returns a world space AABB enclosing this shape.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A class for describing a shape's surface properties.
This structure captures results for a single raycast query.
A sphere shaped collision detection primitive.
A shapes which is used to represent an instance of an convex mesh.
static LPoint3f nxVec3_to_point3(const NxVec3 &p)
Converts from NxVec3 to LPoint3f.
bool get_flag(const PhysxShapeFlag flag) const
Returns the specified shape flag.
PhysxGroupsMask get_groups_mask() const
Gets 128-bit mask used for collision filtering.
Represents an ray as an origin and direction.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void set_local_mat(const LMatrix4f &mat)
Set the transform of the shape in actor space, i.e.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
const char * get_name() const
Returns the name string.
A special shape used for simulating a car wheel.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void set_flag(const PhysxShapeFlag flag, bool value)
Sets the specified shape flag.
Represents an oriented bounding box, as a center point, extents(radii) and a rotation.
void set_group(unsigned short group)
Sets which collision group this shape is part of.
A shapes which is used to represent an instance of an convex mesh.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Abstract base class for shapes.
static NxMat34 mat4_to_nxMat34(const LMatrix4f &m)
Converts from LMatrix4f to NxMat34.
bool check_overlap_obb(const PhysxBox &world_box) const
Checks whether the shape overlaps a world-space OBB or not.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
unsigned short get_group() const
Retrieves the collision group set for this shape.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool check_overlap_aabb(const PhysxBounds3 &world_bounds) const
Checks whether the shape overlaps a world-space AABB or not.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
LMatrix4f get_local_mat() const
Retrieve 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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.