Go to the source code of this file.
|
|
Definition at line 37 of file PhysicsJoint.h. |
|
|
Definition at line 29 of file PhysicsJoint.h. Referenced by gePhysicsJoint_GetType(), gePhysicsSystem_AddJoint(), and gePhysicsSystem_EnforceConstraints().
00030 {
00031 JT_WORLD = 0,
00032 JT_SPHERICAL,
00033 JT_PTTOPATH,
00034 JT_PTTOSURFACE
00035 } gePhysicsJoint_Kind;
|
|
||||||||||||||||||||||||||||
|
Definition at line 48 of file PhysicsJoint.c. References gePhysicsJoint::assemblyRate, GE_RAM_ALLOCATE_STRUCT, GENESISAPI, GENESISCC, gePhysicsObject_GetLocation(), geVec3d_Copy(), geVec3d_Scale(), geVec3d_Subtract(), JOINT_ASSEMBLY_RATE_MULTIPLIER, JT_SPHERICAL, JT_WORLD, gePhysicsJoint::locationA, gePhysicsJoint::locationB, NULL, gePhysicsJoint::Object1, gePhysicsJoint::Object2, and gePhysicsJoint::Type. Referenced by PhysicsJoint_Spawn().
00050 {
00051 gePhysicsJoint* pPhysjnt;
00052 geVec3d POLocation;
00053 geVec3d physicsSpaceLocation;
00054
00055 pPhysjnt = NULL;
00056 pPhysjnt = GE_RAM_ALLOCATE_STRUCT(gePhysicsJoint);
00057 if (pPhysjnt == NULL)
00058 {
00059 return NULL;
00060 }
00061
00063 // make sure the joint makes sense
00064
00065 pPhysjnt->Type = Kind;
00066 pPhysjnt->assemblyRate = assemblyRate * JOINT_ASSEMBLY_RATE_MULTIPLIER;
00067 pPhysjnt->Object1 = PS1;
00068 pPhysjnt->Object2 = PS2;
00069
00070 geVec3d_Scale(Location, physicsScale, &physicsSpaceLocation);
00071
00072 switch (Kind)
00073 {
00074 case JT_WORLD:
00075 if (PS1 == NULL)
00076 {
00077 /*
00078 GenVSI_Error(VSI,
00079 GE_FALSE,
00080 "Joint_Spawn: World joint needs non-NULL gePhysicsObject1 field.\n");
00081 */
00082 return NULL;
00083 }
00084 #if 0
00085 if (pJoint->Next == pJoint)
00086 {
00087 /*
00088 GenVSI_Error(VSI,
00089 GE_FALSE,
00090 "Joint_Spawn: Next field points to parent.\n");
00091 */
00092 return NULL;
00093 }
00094 #endif
00095
00096 gePhysicsObject_GetLocation(PS1, &POLocation, 0);
00097
00098 geVec3d_Subtract(&physicsSpaceLocation,
00099 &POLocation,
00100 &pPhysjnt->locationA);
00101 geVec3d_Copy(&physicsSpaceLocation, &pPhysjnt->locationB);
00102 break;
00103
00104 case JT_SPHERICAL:
00105 if (PS1 == NULL || PS2 == NULL)
00106 {
00107 /*
00108 GenVSI_Error(VSI,
00109 GE_FALSE,
00110 "Joint_Spawn: Spherical joint needs 2 non-NULL gePhysicsObjects.\n");
00111 */
00112 return NULL;
00113 }
00114 #if 0
00115 if (pJoint->Next == pJoint)
00116 {
00117 /*
00118 GenVSI_Error(VSI,
00119 GE_FALSE,
00120 "Joint_Spawn: Next field points to parent.\n");
00121 */
00122 }
00123 #endif
00124 if (PS1 == PS2)
00125 {
00126 /*
00127 GenVSI_Error(VSI,
00128 GE_FALSE,
00129 "Joint_Spawn: Spherical joint: need 2 distinct gePhysicsObjects.\n");
00130 */
00131 return NULL;
00132 }
00133
00134 gePhysicsObject_GetLocation(PS1, &POLocation, 0);
00135 geVec3d_Subtract(&physicsSpaceLocation,
00136 &POLocation,
00137 &pPhysjnt->locationA);
00138
00139 gePhysicsObject_GetLocation(PS2, &POLocation, 0);
00140 geVec3d_Subtract(&physicsSpaceLocation,
00141 &POLocation,
00142 &pPhysjnt->locationB);
00143 break;
00144
00145 default:
00146 /*
00147 GenVSI_Error(VSI,
00148 GE_FALSE,
00149 "Joint_Spawn: unsupported joint type %d.\n", ij->jointType);
00150 */
00151 return NULL;
00152 }
00153
00154 return pPhysjnt;
00155 }
|
|
|
Definition at line 157 of file PhysicsJoint.c. References GE_TRUE, geBoolean, GENESISAPI, GENESISCC, geRam_Free, and NULL. Referenced by PhysicsJoint_Destroy().
00158 {
00159 assert(ppPhysjnt != NULL);
00160 assert(*ppPhysjnt != NULL);
00161
00162 geRam_Free(*ppPhysjnt);
00163
00164 *ppPhysjnt = NULL;
00165
00166 return GE_TRUE;
00167 }
|
|
|
Definition at line 254 of file PhysicsJoint.c. References gePhysicsJoint::assemblyRate, geFloat, GENESISAPI, GENESISCC, and NULL. Referenced by gePhysicsSystem_EnforceConstraints().
00255 {
00256 assert(pPhysjnt != NULL);
00257
00258 return pPhysjnt->assemblyRate;
00259 }
|
|
||||||||||||
|
Definition at line 176 of file PhysicsJoint.c. References GENESISAPI, GENESISCC, geVec3d_Copy(), gePhysicsJoint::locationA, and NULL. Referenced by gePhysicsSystem_EnforceConstraints().
00177 {
00178 assert(pPhysjnt != NULL);
00179 assert(pLoc != NULL);
00180
00181 geVec3d_Copy(&pPhysjnt->locationA, pLoc);
00182 }
|
|
||||||||||||
|
Definition at line 208 of file PhysicsJoint.c. References GENESISAPI, GENESISCC, geVec3d_Copy(), gePhysicsJoint::locationAInWorldSpace, and NULL. Referenced by gePhysicsSystem_EnforceConstraints().
00209 {
00210 assert(pPhysjnt != NULL);
00211 assert(pLoc != NULL);
00212
00213 geVec3d_Copy(&pPhysjnt->locationAInWorldSpace, pLoc);
00214 }
|
|
||||||||||||
|
Definition at line 184 of file PhysicsJoint.c. References GENESISAPI, GENESISCC, geVec3d_Copy(), gePhysicsJoint::locationB, and NULL. Referenced by gePhysicsSystem_EnforceConstraints().
00185 {
00186 assert(pPhysjnt != NULL);
00187 assert(pLoc != NULL);
00188
00189 geVec3d_Copy(&pPhysjnt->locationB, pLoc);
00190 }
|
|
||||||||||||
|
Definition at line 216 of file PhysicsJoint.c. References GENESISAPI, GENESISCC, geVec3d_Copy(), gePhysicsJoint::locationBInWorldSpace, and NULL. Referenced by gePhysicsSystem_EnforceConstraints().
00217 {
00218 assert(pPhysjnt != NULL);
00219 assert(pLoc != NULL);
00220
00221 geVec3d_Copy(&pPhysjnt->locationBInWorldSpace, pLoc);
00222 }
|
|
|
Definition at line 240 of file PhysicsJoint.c. References GENESISAPI, GENESISCC, NULL, and gePhysicsJoint::Object1. Referenced by gePhysicsSystem_EnforceConstraints().
00241 {
00242 assert(pPhysjnt != NULL);
00243
00244 return pPhysjnt->Object1;
00245 }
|
|
|
Definition at line 247 of file PhysicsJoint.c. References GENESISAPI, GENESISCC, NULL, and gePhysicsJoint::Object2. Referenced by gePhysicsSystem_EnforceConstraints().
00248 {
00249 assert(pPhysjnt != NULL);
00250
00251 return pPhysjnt->Object2;
00252 }
|
|
|
Definition at line 169 of file PhysicsJoint.c. References GENESISAPI, GENESISCC, gePhysicsJoint_Kind, NULL, and gePhysicsJoint::Type. Referenced by gePhysicsSystem_AddJoint(), and gePhysicsSystem_EnforceConstraints().
00170 {
00171 assert(pPhysjnt != NULL);
00172
00173 return pPhysjnt->Type;
00174 }
|
|
||||||||||||
|
Definition at line 261 of file PhysicsJoint.c. References gePhysicsJoint::assemblyRate, geFloat, GENESISAPI, GENESISCC, and NULL.
00262 {
00263 assert(pPhysjnt != NULL);
00264 assert(assemblyRate >= (geFloat)(1e-5));
00265
00266 pPhysjnt->assemblyRate = assemblyRate;
00267 }
|
|
||||||||||||
|
Definition at line 192 of file PhysicsJoint.c. References GENESISAPI, GENESISCC, geVec3d_Copy(), gePhysicsJoint::locationA, and NULL.
00193 {
00194 assert(pPhysjnt != NULL);
00195 assert(pLoc != NULL);
00196
00197 geVec3d_Copy(pLoc, &pPhysjnt->locationA);
00198 }
|
|
||||||||||||
|
Definition at line 224 of file PhysicsJoint.c. References GENESISAPI, GENESISCC, geVec3d_Copy(), gePhysicsJoint::locationAInWorldSpace, and NULL. Referenced by gePhysicsSystem_EnforceConstraints().
00225 {
00226 assert(pPhysjnt != NULL);
00227 assert(pLoc != NULL);
00228
00229 geVec3d_Copy(pLoc, &pPhysjnt->locationAInWorldSpace);
00230 }
|
|
||||||||||||
|
Definition at line 200 of file PhysicsJoint.c. References GENESISAPI, GENESISCC, geVec3d_Copy(), gePhysicsJoint::locationB, and NULL.
00201 {
00202 assert(pPhysjnt != NULL);
00203 assert(pLoc != NULL);
00204
00205 geVec3d_Copy(pLoc, &pPhysjnt->locationB);
00206 }
|
|
||||||||||||
|
Definition at line 232 of file PhysicsJoint.c. References GENESISAPI, GENESISCC, geVec3d_Copy(), gePhysicsJoint::locationBInWorldSpace, and NULL. Referenced by gePhysicsSystem_EnforceConstraints().
00233 {
00234 assert(pPhysjnt != NULL);
00235 assert(pLoc != NULL);
00236
00237 geVec3d_Copy(pLoc, &pPhysjnt->locationBInWorldSpace);
00238 }
|
1.3.2