Panda3D

Loading...
Searching...
No Matches
physxJoint.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 physxJoint.h
10 * @author enn0x
11 * @date 2009-10-02
12 */
13
14#ifndef PHYSXJOINT_H
15#define PHYSXJOINT_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
25 class PhysxActor;
26 class PhysxScene;
27
28/**
29 * Abstract base class for the different types of joints. All joints are used
30 * to connect two dynamic actors, or an actor and the environment.
31 */
32 class EXPCL_PANDAPHYSX PhysxJoint : public PhysxObject, public PhysxEnums {
33
34PUBLISHED:
35 void release();
36
37 PhysxActor *get_actor(unsigned int idx) const;
38 PhysxScene *get_scene() const;
39
40 void purge_limit_planes();
41
42 void set_name(const char *name);
43 void set_global_anchor(const LPoint3f &anchor);
44 void set_global_axis(const LVector3f &axis);
45 void set_breakable(float maxForce, float maxTorque);
46 void set_solver_extrapolation_factor(float factor);
47 void set_use_acceleration_spring(bool value);
48 void set_limit_point(const LPoint3f &pos, bool isOnActor2=true);
49 void add_limit_plane(const LVector3f &normal, const LPoint3f &pointInPlane, float restitution=0.0f);
50
51 const char *get_name() const;
52 LPoint3f get_global_anchor() const;
53 LVector3f get_global_axis() const;
54 float get_solver_extrapolation_factor() const;
55 bool get_use_acceleration_spring() const;
56
57 INLINE void ls() const;
58 INLINE void ls(std::ostream &out, int indent_level=0) const;
59
60 public:
61 static PhysxJoint *factory(NxJointType shapeType);
62
63 virtual NxJoint *ptr() const = 0;
64
65 virtual void link(NxJoint *shapePtr) = 0;
66 virtual void unlink() = 0;
67
68 protected:
69 INLINE PhysxJoint();
70
71 private:
72 std::string _name;
73
74 public:
75 static TypeHandle get_class_type() {
76 return _type_handle;
77 }
78 static void init_type() {
79 PhysxObject::init_type();
80 register_type(_type_handle, "PhysxJoint",
81 PhysxObject::get_class_type());
82 }
83 virtual TypeHandle get_type() const {
84 return get_class_type();
85 }
86 virtual TypeHandle force_init_type() {
87 init_type();
88 return get_class_type();
89 }
90
91 private:
92 static TypeHandle _type_handle;
93};
94
95#include "physxJoint.I"
96
97#endif // PHYSXJOINT_H
PhysxActor
Actors are the main simulation objects.
Definition physxActor.h:44
PhysxEnums
This class exists just to provide scoping for the enums shared by PhysX classes.
Definition physxEnums.h:355
PhysxJoint::get_actor
PhysxActor * get_actor(unsigned int idx) const
Retrieves the actor which this joint is associated with.
Definition physxJoint.cxx:113
PhysxJoint::add_limit_plane
void add_limit_plane(const LVector3f &normal, const LPoint3f &pointInPlane, float restitution=0.0f)
Adds a limit plane.
Definition physxJoint.cxx:278
PhysxJoint::get_name
const char * get_name() const
Returns the name string.
Definition physxJoint.cxx:103
PhysxJoint::get_solver_extrapolation_factor
float get_solver_extrapolation_factor() const
Retrieves the solver extrapolation factor.
Definition physxJoint.cxx:238
PhysxJoint::purge_limit_planes
void purge_limit_planes()
Deletes all limit planes added to the joint.
Definition physxJoint.cxx:290
PhysxJoint::get_scene
PhysxScene * get_scene() const
Retrieves the scene which this joint is associated with.
Definition physxJoint.cxx:127
PhysxJoint::set_limit_point
void set_limit_point(const LPoint3f &pos, bool isOnActor2=true)
Sets the limit point.
Definition physxJoint.cxx:262
PhysxJoint::set_name
void set_name(const char *name)
Sets a name string for this object.
Definition physxJoint.cxx:91
PhysxJoint::set_use_acceleration_spring
void set_use_acceleration_spring(bool value)
Switch between acceleration and force based spring.
Definition physxJoint.cxx:208
PhysxJoint::set_global_anchor
void set_global_anchor(const LPoint3f &anchor)
Sets the point where the two actors are attached, specified in global coordinates.
Definition physxJoint.cxx:138
PhysxJoint::set_breakable
void set_breakable(float maxForce, float maxTorque)
Sets the maximum force magnitude that the joint is able to withstand without breaking.
Definition physxJoint.cxx:198
PhysxJoint::set_global_axis
void set_global_axis(const LVector3f &axis)
Sets the direction of the joint's primary axis, specified in global coordinates.
Definition physxJoint.cxx:159
PhysxJoint::set_solver_extrapolation_factor
void set_solver_extrapolation_factor(float factor)
Sets the solver extrapolation factor.
Definition physxJoint.cxx:228
PhysxJoint::get_global_anchor
LPoint3f get_global_anchor() const
Retrieves the joint anchor.
Definition physxJoint.cxx:148
PhysxJoint::get_global_axis
LVector3f get_global_axis() const
Retrieves the joint axis.
Definition physxJoint.cxx:169
PhysxJoint::get_use_acceleration_spring
bool get_use_acceleration_spring() const
Checks whether acceleration spring is used.
Definition physxJoint.cxx:218
PhysxScene
A scene is a collection of bodies, constraints, and effectors which can interact.
Definition physxScene.h:69
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
luse.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
physxEnums.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
physxJoint.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
physxObject.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
physx_includes.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pointerTo.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition register_type.I:22