source: GTP/trunk/App/Games/Jungle_Rumble/src/physic/physics/include/NxPulleyJointDesc.h @ 1378

Revision 1378, 2.8 KB checked in by giegl, 18 years ago (diff)

GTPD - Jungle Rumble - integrate into GTP SVN structure

Line 
1#ifndef NX_PHYSICS_NXPULLEYJOINTDESC
2#define NX_PHYSICS_NXPULLEYJOINTDESC
3/*----------------------------------------------------------------------------*\
4|
5|                                               Public Interface to NovodeX Technology
6|
7|                                                            www.novodex.com
8|
9\*----------------------------------------------------------------------------*/
10/** \addtogroup physics
11  @{
12*/
13
14#include "Nxp.h"
15#include "NxJointDesc.h"
16#include "NxMotorDesc.h"
17
18/**
19\brief Desc class for #NxPulleyJoint.
20
21<b>Platform:</b>
22\li PC SW: Yes
23\li PPU  : No
24\li PS3  : Yes
25\li XB360: Yes
26
27@see NxPulleyJoint NxJointDesc
28*/
29class NxPulleyJointDesc : public NxJointDesc
30        {
31        public:
32        /**
33        \brief suspension points of two bodies in world space.
34
35        <b>Range:</b> position vector<br>
36        <b>Default:</b> [0]Zero<br>
37        <b>Default:</b> [1]Zero
38        */
39        NxVec3 pulley[2];
40
41        /**
42        \brief the rest length of the rope connecting the two objects.
43       
44        The distance is computed as ||(pulley0 - anchor0)|| +  ||(pulley1 - anchor1)|| * ratio.
45
46        <b>Range:</b> [0,inf)<br>
47        <b>Default:</b> 0.0
48        */
49        NxReal distance;
50
51        /**
52        \brief how stiff the constraint is, between 0 and 1 (stiffest)
53
54        <b>Range:</b> [0,1]<br>
55        <b>Default:</b> 1.0
56        */
57        NxReal stiffness;
58
59        /**
60        \brief transmission ratio
61
62        <b>Range:</b> (0,inf)<br>
63        <b>Default:</b> 1.0
64        */
65        NxReal ratio;
66
67        /**
68        \brief This is a combination of the bits defined by ::NxPulleyJointFlag.
69
70        <b>Default:</b> 0
71
72        @see NxPulleyJointFlag.
73        */
74        NxU32  flags;
75
76        /**
77        \brief Optional joint motor.
78
79        <b>Range:</b> See #NxMotorDesc<br>
80        <b>Default:</b> See #NxMotorDesc
81
82        @see NxMotorDesc
83        */
84        NxMotorDesc     motor;
85
86        /**
87        \brief constructor sets to default.
88        */
89        NX_INLINE NxPulleyJointDesc(); 
90        /**
91        \brief (re)sets the structure to the default.   
92        */
93        NX_INLINE void setToDefault();
94        /**
95        \brief Returns true if the descriptor is valid.
96        \return true if the current settings are valid
97        */
98        NX_INLINE bool isValid() const;
99
100        };
101
102NX_INLINE NxPulleyJointDesc::NxPulleyJointDesc() : NxJointDesc(NX_JOINT_PULLEY) //constructor sets to default
103        {
104        setToDefault();
105        }
106
107NX_INLINE void NxPulleyJointDesc::setToDefault()
108        {
109        pulley[0].zero();
110        pulley[1].zero();
111
112        distance = 0.0f;
113        stiffness = 1.0f;
114        ratio = 1.0f;
115        flags = 0;
116
117        motor.setToDefault();
118
119        NxJointDesc::setToDefault();
120        }
121
122NX_INLINE bool NxPulleyJointDesc::isValid() const
123        {
124        if (distance < 0) return false;
125        if (stiffness < 0 || stiffness > 1) return false;
126        if (ratio < 0) return false;
127        if (!motor.isValid()) return false;
128
129        return NxJointDesc::isValid();
130        }
131
132/** @} */
133#endif
134
135
136//AGCOPYRIGHTBEGIN
137///////////////////////////////////////////////////////////////////////////
138// Copyright © 2005 AGEIA Technologies.
139// All rights reserved. www.ageia.com
140///////////////////////////////////////////////////////////////////////////
141//AGCOPYRIGHTEND
142
Note: See TracBrowser for help on using the repository browser.