69class EXPCL_PANDAPHYSX PhysxScene :
public PhysxObject,
public PhysxEnums {
82 void enable_contact_reporting(
bool enabled);
83 bool is_contact_reporting_enabled()
const;
84 void enable_trigger_reporting(
bool enabled);
85 bool is_trigger_reporting_enabled()
const;
86 void enable_controller_reporting(
bool enabled);
87 bool is_controller_reporting_enabled()
const;
89 INLINE
void set_controller_shape_hit_callback(PT(
CallbackObject) cbobj);
90 INLINE
void set_controller_controller_hit_callback(PT(
CallbackObject) cbobj);
96 bool get_flag(PhysxSceneFlag flag)
const;
100 unsigned int get_num_actors()
const;
102 PhysxActor *get_actor(
unsigned int idx)
const;
103 MAKE_SEQ(get_actors, get_num_actors, get_actor);
158 PhysxShapesType shapesType=ST_all,
163 PhysxShapesType shapesType=ST_all,
168 PhysxShapesType shapesType=ST_all,
173 PhysxShapesType shapesType=ST_all,
178 PhysxShapesType shapesType=ST_all,
183 PhysxShapesType shapesType=ST_all,
189 PhysxShapesType shapesType=ST_all,
193 PhysxShapesType shapesType=ST_all,
201 void set_filter_ops(PhysxFilterOp op0, PhysxFilterOp op1, PhysxFilterOp op2);
222 INLINE
void ls()
const;
223 INLINE
void ls(std::ostream &out,
int indent_level=0)
const;
226 INLINE NxScene *ptr()
const {
return _ptr; };
227 INLINE NxControllerManager *cm()
const {
return _cm; };
229 void link(NxScene *ptr);
232 PhysxObjectCollection<PhysxMaterial> _materials;
233 PhysxObjectCollection<PhysxActor> _actors;
234 PhysxObjectCollection<PhysxJoint> _joints;
235 PhysxObjectCollection<PhysxForceField> _forcefields;
236 PhysxObjectCollection<PhysxForceFieldShapeGroup> _ffgroups;
237 PhysxObjectCollection<PhysxController> _controllers;
238 PhysxObjectCollection<PhysxVehicle> _vehicles;
239 PhysxObjectCollection<PhysxCloth> _cloths;
240 PhysxObjectCollection<PhysxSoftBody> _softbodies;
242 PhysxMaterial *get_wheel_shape_material();
246 NxControllerManager *_cm;
247 PT(PhysxDebugGeomNode) _debugNode;
248 PT(PhysxMaterial) _wheelShapeMaterial;
250 PhysxContactReport _contact_report;
251 PhysxControllerReport _controller_report;
252 PhysxTriggerReport _trigger_report;
254 static PStatCollector _pcollector_fetch_results;
255 static PStatCollector _pcollector_update_transforms;
256 static PStatCollector _pcollector_debug_renderer;
257 static PStatCollector _pcollector_simulate;
258 static PStatCollector _pcollector_cloth;
259 static PStatCollector _pcollector_softbody;
262 static TypeHandle get_class_type() {
265 static void init_type() {
266 PhysxObject::init_type();
268 PhysxObject::get_class_type());
270 virtual TypeHandle get_type()
const {
271 return get_class_type();
273 virtual TypeHandle force_init_type() {
275 return get_class_type();
279 static TypeHandle _type_handle;
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is a generic object that can be assigned to a callback at various points in the rendering proces...
Descriptor for PhysxActor.
Actors are the main simulation objects.
Descriptor for PhysxCloth.
Expresses the dominance relationship of a constraint.
Descriptor class for a character controller.
Abstract base class for character controllers.
Renderable geometry which represents visualizations of physics objects.
This class exists just to provide scoping for the enums shared by PhysX classes.
Descriptor class for force fields.
Abstract base class for joint descriptors.
Abstract base class for the different types of joints.
static PhysxMask all_on()
Returns a PhysxMask whose bits are all on.
Descriptor class for materials.
A class for describing a shape's surface properties.
Objects of this class are returned by the 'overlap shape' methods, for example overlapSphereShapes.
Represents an ray as an origin and direction.
This structure captures results for a single raycast query.
Objects of this class are returned by the 'raycast all' methods.
get_vehicle
Returns the n-th vehicle from the array of all the vehicles in the scene.
unsigned int get_hightest_material_index() const
Returns current highest valid material index.
PhysxSoftBody * create_soft_body(PhysxSoftBodyDesc &desc)
Creates a soft body in this scene.
void set_group_collision_flag(unsigned int g1, unsigned int g2, bool enable)
Specifies if collision should be performed by a pair of shape groups.
get_num_force_fields
Gets the number of force fields in the scene.
void set_timing_fixed(float maxTimestep=1.0f/60.0f, unsigned int maxIter=8)
Sets simulation timing parameters used in simulate.
get_num_controllers
Return the number of controllers in the scene.
get_soft_body
Returns the n-th soft body from the array of all the soft bodies in the scene.
PhysxForceField * create_force_field(PhysxForceFieldDesc &desc)
Creates a force field in this scene.
void set_filter_constant0(const PhysxGroupsMask &mask)
Setups filtering's K0 value.
bool is_hardware_scene() const
Returns TRUE if the the scene is simulated in hardware.
get_cloth
Returns the n-th cloth from the array of all the cloths in the scene.
PhysxGroupsMask get_filter_constant1() const
Gets filtering constant K1.
void set_filter_constant1(const PhysxGroupsMask &mask)
Setups filtering's K1 value.
PhysxOverlapReport overlap_sphere_shapes(const LPoint3f ¢er, float radius, PhysxShapesType shapesType=ST_all, PhysxMask mask=PhysxMask::all_on(), bool accurateCollision=true) const
Returns the set of shapes overlapped by the world-space sphere.
void simulate(float dt)
Advances the simulation by an elapsedTime time.
bool get_actor_group_pair_flag(unsigned int g1, unsigned int g2, PhysxContactPairFlag flag)
Retrieves a single flag set with PhysxScene::set_actor_group_pair_flag()
void set_shape_pair_flag(PhysxShape &shapeA, PhysxShape &shapeB, bool value)
Disables or enables contact generation for a pair of shapes.
void set_actor_pair_flag(PhysxActor &actorA, PhysxActor &actorB, PhysxContactPairFlag flag, bool value)
Sets the pair flags for the given pair of actors.
bool get_actor_pair_flag(PhysxActor &actorA, PhysxActor &actorB, PhysxContactPairFlag flag)
Retrieves a single flag for the given pair of actors.
get_num_materials
Return the number of materials in the scene.
bool get_group_collision_flag(unsigned int g1, unsigned int g2)
Determines if collision detection is performed between a pair of groups.
void set_dominance_group_pair(unsigned int g1, unsigned int g2, PhysxConstraintDominance dominance)
Specifies the dominance behavior of constraints between two actors with two certain dominance groups.
void fetch_results()
Waits until the simulation has finished, and then updates the scene graph with with simulation result...
PhysxForceFieldShapeGroup * create_force_field_shape_group(PhysxForceFieldShapeGroupDesc &desc)
Creates a new force field shape group in this scene.
PhysxFilterOp get_filter_op1() const
Retrieves the op1 filtering operation.
PhysxConstraintDominance get_dominance_group_pair(unsigned int g1, unsigned int g2)
Samples the dominance matrix.
PhysxRaycastHit raycast_closest_shape(const PhysxRay &ray, PhysxShapesType shapesType=ST_all, PhysxMask mask=PhysxMask::all_on(), PhysxGroupsMask *groups=nullptr, bool smoothNormal=true) const
Returns the first shape that is hit along the ray.
void set_timing_variable()
Sets simulation timing parameters used in simulate.
PhysxFilterOp get_filter_op2() const
Retrieves the op2 filtering operation.
PhysxMaterial * get_material_from_index(unsigned int idx) const
Retrieves the material with the given material index.
get_material
Retrieves the n-th material from the array of materials.
PhysxRaycastReport raycast_all_shapes(const PhysxRay &ray, PhysxShapesType shapesType=ST_all, PhysxMask mask=PhysxMask::all_on(), PhysxGroupsMask *groups=nullptr, bool smoothNormal=true) const
Returns a PhysxRaycastReport object which can be used to iterate over all shapes that have been hit b...
bool raycast_any_bounds(const PhysxRay &ray, PhysxShapesType shapesType=ST_all, PhysxMask mask=PhysxMask::all_on(), PhysxGroupsMask *groups=nullptr) const
Returns true if any axis aligned bounding box enclosing a shape is intersected by the ray.
get_force_field
Returns the n-th force field from the array of all the force fields in the scene.
void set_filter_ops(PhysxFilterOp op0, PhysxFilterOp op1, PhysxFilterOp op2)
Setups filtering operations.
get_controller
Retrieves the n-th controller within the scene.
PhysxFilterOp get_filter_op0() const
Retrieves the op0 filtering operation.
PhysxGroupsMask get_filter_constant0() const
Gets filtering constant K0.
PhysxJoint * create_joint(PhysxJointDesc &desc)
Creates a joint in this scene.
PhysxCloth * create_cloth(PhysxClothDesc &desc)
Creates a cloth in this scene.
PhysxVehicle * create_vehicle(PhysxVehicleDesc &desc)
Creates a vehicle in this scene.
PhysxMaterial * create_material(PhysxMaterialDesc &desc)
Creates a new PhysxMaterial.
get_num_cloths
Gets the number of cloths in the scene.
LVector3f get_gravity() const
Retrieves the current gravity setting.
PhysxRaycastReport raycast_all_bounds(const PhysxRay &ray, PhysxShapesType shapesType=ST_all, PhysxMask mask=PhysxMask::all_on(), PhysxGroupsMask *groups=nullptr, bool smoothNormal=true) const
Returns a PhysxRaycastReport object which can be used to iterate over all shapes that have been enclo...
bool get_flag(PhysxSceneFlag flag) const
Return the specified scene flag flag.
void set_filter_bool(bool flag)
Setups filtering's boolean value.
bool raycast_any_shape(const PhysxRay &ray, PhysxShapesType shapesType=ST_all, PhysxMask mask=PhysxMask::all_on(), PhysxGroupsMask *groups=nullptr) const
Returns true if any shape is intersected by the ray.
bool get_filter_bool() const
Retrieves filtering's boolean value.
void set_actor_group_pair_flag(unsigned int g1, unsigned int g2, PhysxContactPairFlag flag, bool value)
With this method one can set contact reporting flags between actors belonging to a pair of groups.
get_joint
Retrieve the n-th joint from the array of all the joints in the scene.
get_num_soft_bodies
Gets the number of soft bodies in the scene.
PhysxController * create_controller(PhysxControllerDesc &controllerDesc)
Creates a new character controller.
get_num_vehicles
Returns the number of vehicles in the scene.
PhysxRaycastHit raycast_closest_bounds(const PhysxRay &ray, PhysxShapesType shapesType=ST_all, PhysxMask mask=PhysxMask::all_on(), PhysxGroupsMask *groups=nullptr, bool smoothNormal=true) const
Returns the first axis aligned bounding box enclosing a shape that is hit along the ray.
PhysxOverlapReport overlap_capsule_shapes(const LPoint3f &p0, const LPoint3f &p1, float radius, PhysxShapesType shapesType=ST_all, PhysxMask mask=PhysxMask::all_on(), bool accurateCollision=true) const
Returns the set of shapes overlapped by the world-space capsule.
PhysxDebugGeomNode * get_debug_geom_node()
Retrieves the debug geom node for this scene.
get_num_joints
Returns the number of joints in the scene (excluding "dead" joints).
get_force_field_shape_group
Returns the n-th force field shape group in this scene.
bool get_shape_pair_flag(PhysxShape &shapeA, PhysxShape &shapeB)
Returns /true/ if contact generation between a pair of shapes is enabled, and /false/ if contact gene...
void set_gravity(const LVector3f &gravity)
Sets a constant gravity for the entire scene.
get_num_force_field_shape_groups
Gets the number of force field shape groups in the scene.
Abstract base class for shapes.
Descriptor for PhysxSoftBody.
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.
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(),...