Panda3D
Loading...
Searching...
No Matches
physxShape.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file physxShape.h
10 * @author enn0x
11 * @date 2009-09-16
12 */
13
14#ifndef PHYSXSHAPE_H
15#define PHYSXSHAPE_H
16
17#include "pandabase.h"
18#include "pointerTo.h"
19#include "luse.h"
20
21#include "physxObject.h"
22#include "physxEnums.h"
23#include "physx_includes.h"
24
25class PhysxActor;
26class PhysxMaterial;
27class PhysxGroupsMask;
28class PhysxBounds3;
29class PhysxSphere;
30class PhysxBox;
31class PhysxCapsule;
32class PhysxRay;
33class PhysxRaycastHit;
35
36/**
37 * Abstract base class for shapes.
38 */
39class EXPCL_PANDAPHYSX PhysxShape : public PhysxObject, public PhysxEnums {
40
41PUBLISHED:
42 void release();
43
44 PhysxActor *get_actor() const;
45
46 void set_name(const char *name);
47 void set_flag(const PhysxShapeFlag flag, bool value);
48 void set_skin_width(float skinWidth);
49 void set_group(unsigned short group);
50 void set_local_pos(const LPoint3f &pos);
51 void set_local_mat(const LMatrix4f &mat);
52 void set_material(const PhysxMaterial &material);
53 void set_material_index(unsigned short idx);
54 void set_groups_mask(const PhysxGroupsMask &mask);
55 void set_ccd_skeleton(PhysxCcdSkeleton *skel);
56
57 const char *get_name() const;
58 bool get_flag(const PhysxShapeFlag flag) const;
59 float get_skin_width() const;
60 unsigned short get_group() const;
61 LPoint3f get_local_pos() const;
62 LMatrix4f get_local_mat() const;
63 unsigned short get_material_index() const;
66 PhysxCcdSkeleton *get_ccd_skeleton() const;
67
68 bool check_overlap_aabb(const PhysxBounds3 &world_bounds) const;
69 bool check_overlap_capsule(const PhysxCapsule &world_capsule) const;
70 bool check_overlap_obb(const PhysxBox &world_box) const;
71 bool check_overlap_sphere(const PhysxSphere &world_sphere) const;
72 PhysxRaycastHit raycast(const PhysxRay &worldRay, bool firstHit, bool smoothNormal) const;
73
74 INLINE void ls() const;
75 INLINE void ls(std::ostream &out, int indent_level=0) const;
76
77public:
78 static PhysxShape *factory(NxShapeType shapeType);
79
80 virtual NxShape *ptr() const = 0;
81
82 virtual void link(NxShape *shapePtr) = 0;
83 virtual void unlink() = 0;
84
85protected:
86 INLINE PhysxShape();
87
88private:
89 std::string _name;
90 PT(PhysxCcdSkeleton) _skel;
91
92public:
93 static TypeHandle get_class_type() {
94 return _type_handle;
95 }
96 static void init_type() {
97 PhysxObject::init_type();
98 register_type(_type_handle, "PhysxShape",
99 PhysxObject::get_class_type());
100 }
101 virtual TypeHandle get_type() const {
102 return get_class_type();
103 }
104 virtual TypeHandle force_init_type() {
105 init_type();
106 return get_class_type();
107 }
108
109private:
110 static TypeHandle _type_handle;
111};
112
113#include "physxShape.I"
114
115#endif // PHYSXSHAPE_H
Actors are the main simulation objects.
Definition physxActor.h:44
Represention of a axis aligned bounding box.
Represents an oriented bounding box, as a center point, extents(radii) and a rotation.
Definition physxBox.h:29
Represents a capsule.
A Convex Mesh.
This class exists just to provide scoping for the enums shared by PhysX classes.
Definition physxEnums.h:355
128-bit bitmask class.
A class for describing a shape's surface properties.
Represents an ray as an origin and direction.
Definition physxRay.h:26
This structure captures results for a single raycast query.
void set_local_pos(const LPoint3f &pos)
Set 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.
LPoint3f get_local_pos() const
Retrieve the position of the shape in actor space, i.e.
bool check_overlap_aabb(const PhysxBounds3 &world_bounds) const
Checks whether the shape overlaps a world-space AABB or not.
void set_group(unsigned short group)
Sets which collision group this shape is part of.
PhysxGroupsMask get_groups_mask() const
Gets 128-bit mask used for collision filtering.
void set_material_index(unsigned short idx)
Assigns a material index to the shape.
bool get_flag(const PhysxShapeFlag flag) const
Returns the specified shape flag.
void set_name(const char *name)
Sets a name string for this object.
void set_material(const PhysxMaterial &material)
Assigns a material to the shape.
bool check_overlap_obb(const PhysxBox &world_box) const
Checks whether the shape overlaps a world-space OBB or not.
void set_skin_width(float skinWidth)
Sets the skin width.
const char * get_name() const
Returns the name string.
float get_skin_width() const
Returns the skin width.
bool check_overlap_sphere(const PhysxSphere &world_sphere) const
Checks whether the shape overlaps a world-space sphere or not.
void set_local_mat(const LMatrix4f &mat)
Set the transform of the shape in actor space, i.e.
unsigned short get_group() const
Retrieves the collision group set for this shape.
LMatrix4f get_local_mat() const
Retrieve the transform of the shape in actor space, i.e.
unsigned short get_material_index() const
Returns the material index currently assigned to the shape.
void set_flag(const PhysxShapeFlag flag, bool value)
Sets the specified shape flag.
PhysxBounds3 get_world_bounds() const
Returns a world space AABB enclosing this shape.
bool check_overlap_capsule(const PhysxCapsule &world_capsule) const
Checks whether the shape overlaps a world-space capsule or not.
PhysxActor * get_actor() const
Retrieves the actor which this shape is associated with.
Represents a sphere defined by its center point and radius.
Definition physxSphere.h:25
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
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.
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 register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...