PhysicsAPI.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. //
  2. // Urho3D Engine
  3. // Copyright (c) 2008-2011 Lasse Öörni
  4. //
  5. // Permission is hereby granted, free of charge, to any person obtaining a copy
  6. // of this software and associated documentation files (the "Software"), to deal
  7. // in the Software without restriction, including without limitation the rights
  8. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. // copies of the Software, and to permit persons to whom the Software is
  10. // furnished to do so, subject to the following conditions:
  11. //
  12. // The above copyright notice and this permission notice shall be included in
  13. // all copies or substantial portions of the Software.
  14. //
  15. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. // THE SOFTWARE.
  22. //
  23. #include "Precompiled.h"
  24. #include "APITemplates.h"
  25. #include "CollisionShape.h"
  26. #include "Joint.h"
  27. #include "PhysicsWorld.h"
  28. #include "RigidBody.h"
  29. #include "Scene.h"
  30. static PhysicsWorld* SceneGetPhysicsWorld(Scene* ptr)
  31. {
  32. return ptr->GetComponent<PhysicsWorld>();
  33. }
  34. static PhysicsWorld* GetPhysicsWorld()
  35. {
  36. Scene* scene = GetScriptContextScene();
  37. return scene ? scene->GetComponent<PhysicsWorld>() : 0;
  38. }
  39. static void ConstructPhysicsRaycastResult(PhysicsRaycastResult* ptr)
  40. {
  41. ptr->position_ = Vector3::ZERO;
  42. ptr->normal_ = Vector3::ZERO;
  43. ptr->distance_ = 0.0f;
  44. ptr->node_ = 0;
  45. }
  46. static Node* PhysicsRaycastResultGetNode(PhysicsRaycastResult* ptr)
  47. {
  48. return ptr->node_;
  49. }
  50. static CScriptArray* PhysicsWorldRaycast(const Ray& ray, float maxDistance, unsigned collisionMask, PhysicsWorld* ptr)
  51. {
  52. static PODVector<PhysicsRaycastResult> result;
  53. ptr->Raycast(result, ray, maxDistance, collisionMask);
  54. return VectorToArray<PhysicsRaycastResult>(result, "Array<PhysicsRaycastResult>");
  55. }
  56. static void RegisterPhysicsWorld(asIScriptEngine* engine)
  57. {
  58. engine->RegisterObjectType("PhysicsRaycastResult", sizeof(PhysicsRaycastResult), asOBJ_VALUE | asOBJ_POD);
  59. engine->RegisterObjectBehaviour("PhysicsRaycastResult", asBEHAVE_CONSTRUCT, "void f()", asFUNCTION(ConstructPhysicsRaycastResult), asCALL_CDECL_OBJLAST);
  60. engine->RegisterObjectProperty("PhysicsRaycastResult", "Vector3 position", offsetof(PhysicsRaycastResult, position_));
  61. engine->RegisterObjectProperty("PhysicsRaycastResult", "Vector3 normal", offsetof(PhysicsRaycastResult, normal_));
  62. engine->RegisterObjectProperty("PhysicsRaycastResult", "float distance", offsetof(PhysicsRaycastResult, distance_));
  63. engine->RegisterObjectMethod("PhysicsRaycastResult", "Node@+ get_node() const", asFUNCTION(PhysicsRaycastResultGetNode), asCALL_CDECL_OBJLAST);
  64. RegisterComponent<PhysicsWorld>(engine, "PhysicsWorld");
  65. engine->RegisterObjectMethod("PhysicsWorld", "void Update(float)", asMETHOD(PhysicsWorld, Update), asCALL_THISCALL);
  66. engine->RegisterObjectMethod("PhysicsWorld", "Array<PhysicsRaycastResult>@ Raycast(const Ray&in, float, uint)", asFUNCTION(PhysicsWorldRaycast), asCALL_CDECL_OBJLAST);
  67. engine->RegisterObjectMethod("PhysicsWorld", "void DrawDebugGeometry(bool)", asMETHOD(PhysicsWorld, DrawDebugGeometry), asCALL_THISCALL);
  68. engine->RegisterObjectMethod("PhysicsWorld", "void set_gravity(Vector3)", asMETHOD(PhysicsWorld, SetGravity), asCALL_THISCALL);
  69. engine->RegisterObjectMethod("PhysicsWorld", "Vector3 get_gravity() const", asMETHOD(PhysicsWorld, GetGravity), asCALL_THISCALL);
  70. engine->RegisterObjectMethod("PhysicsWorld", "void set_fps(int)", asMETHOD(PhysicsWorld, SetFps), asCALL_THISCALL);
  71. engine->RegisterObjectMethod("PhysicsWorld", "int get_fps() const", asMETHOD(PhysicsWorld, GetFps), asCALL_THISCALL);
  72. engine->RegisterObjectMethod("PhysicsWorld", "void set_maxContacts(uint)", asMETHOD(PhysicsWorld, SetMaxContacts), asCALL_THISCALL);
  73. engine->RegisterObjectMethod("PhysicsWorld", "uint get_maxContacts() const", asMETHOD(PhysicsWorld, GetMaxContacts), asCALL_THISCALL);
  74. engine->RegisterObjectMethod("PhysicsWorld", "void set_linearRestThreshold(float)", asMETHOD(PhysicsWorld, SetLinearRestThreshold), asCALL_THISCALL);
  75. engine->RegisterObjectMethod("PhysicsWorld", "float get_linearRestThreshold() const", asMETHOD(PhysicsWorld, GetLinearRestThreshold), asCALL_THISCALL);
  76. engine->RegisterObjectMethod("PhysicsWorld", "void set_angularRestThreshold(float)", asMETHOD(PhysicsWorld, SetAngularRestThreshold), asCALL_THISCALL);
  77. engine->RegisterObjectMethod("PhysicsWorld", "float get_angularRestThreshold() const", asMETHOD(PhysicsWorld, GetAngularRestThreshold), asCALL_THISCALL);
  78. engine->RegisterObjectMethod("PhysicsWorld", "void set_bounceThreshold(float)", asMETHOD(PhysicsWorld, SetBounceThreshold), asCALL_THISCALL);
  79. engine->RegisterObjectMethod("PhysicsWorld", "float get_bounceThreshold() const", asMETHOD(PhysicsWorld, GetBounceThreshold), asCALL_THISCALL);
  80. engine->RegisterObjectMethod("PhysicsWorld", "void set_erp(float)", asMETHOD(PhysicsWorld, SetERP), asCALL_THISCALL);
  81. engine->RegisterObjectMethod("PhysicsWorld", "float get_erp() const", asMETHOD(PhysicsWorld, GetERP), asCALL_THISCALL);
  82. engine->RegisterObjectMethod("PhysicsWorld", "void set_cfm(float)", asMETHOD(PhysicsWorld, SetCFM), asCALL_THISCALL);
  83. engine->RegisterObjectMethod("PhysicsWorld", "float get_cfm() const", asMETHOD(PhysicsWorld, GetCFM), asCALL_THISCALL);
  84. engine->RegisterObjectMethod("PhysicsWorld", "void set_contactSurfaceLayer(float)", asMETHOD(PhysicsWorld, SetContactSurfaceLayer), asCALL_THISCALL);
  85. engine->RegisterObjectMethod("PhysicsWorld", "float get_contactSurfaceLayer() const", asMETHOD(PhysicsWorld, GetContactSurfaceLayer), asCALL_THISCALL);
  86. engine->RegisterObjectMethod("PhysicsWorld", "void set_linearDampingThreshold(float)", asMETHOD(PhysicsWorld, SetLinearDampingThreshold), asCALL_THISCALL);
  87. engine->RegisterObjectMethod("PhysicsWorld", "float get_linearDampingThreshold() const", asMETHOD(PhysicsWorld, GetLinearDampingThreshold), asCALL_THISCALL);
  88. engine->RegisterObjectMethod("PhysicsWorld", "void set_linearDampingScale(float)", asMETHOD(PhysicsWorld, SetLinearDampingScale), asCALL_THISCALL);
  89. engine->RegisterObjectMethod("PhysicsWorld", "float get_linearDampingScale() const", asMETHOD(PhysicsWorld, GetLinearDampingScale), asCALL_THISCALL);
  90. engine->RegisterObjectMethod("PhysicsWorld", "void set_angularDampingThreshold(float)", asMETHOD(PhysicsWorld, SetAngularDampingThreshold), asCALL_THISCALL);
  91. engine->RegisterObjectMethod("PhysicsWorld", "float get_angularDampingThreshold() const", asMETHOD(PhysicsWorld, GetAngularDampingThreshold), asCALL_THISCALL);
  92. engine->RegisterObjectMethod("PhysicsWorld", "void set_angularDampingScale(float)", asMETHOD(PhysicsWorld, SetAngularDampingScale), asCALL_THISCALL);
  93. engine->RegisterObjectMethod("PhysicsWorld", "float get_angularDampingScale() const", asMETHOD(PhysicsWorld, GetAngularDampingScale), asCALL_THISCALL);
  94. engine->RegisterObjectMethod("Scene", "PhysicsWorld@+ get_physicsWorld() const", asFUNCTION(SceneGetPhysicsWorld), asCALL_CDECL_OBJLAST);
  95. engine->RegisterGlobalFunction("PhysicsWorld@+ get_physicsWorld()", asFUNCTION(GetPhysicsWorld), asCALL_CDECL);
  96. // Register Variant GetPtr() for PhysicsWorld
  97. engine->RegisterObjectMethod("Variant", "PhysicsWorld@+ GetPhysicsWorld() const", asFUNCTION(GetVariantPtr<PhysicsWorld>), asCALL_CDECL_OBJLAST);
  98. }
  99. static void RegisterCollisionShape(asIScriptEngine* engine)
  100. {
  101. engine->RegisterEnum("ShapeType");
  102. engine->RegisterEnumValue("ShapeType", "SHAPE_NONE", SHAPE_NONE);
  103. engine->RegisterEnumValue("ShapeType", "SHAPE_BOX", SHAPE_BOX);
  104. engine->RegisterEnumValue("ShapeType", "SHAPE_SPHERE", SHAPE_SPHERE);
  105. engine->RegisterEnumValue("ShapeType", "SHAPE_CAPSULE", SHAPE_CAPSULE);
  106. engine->RegisterEnumValue("ShapeType", "SHAPE_CYLINDER", SHAPE_CYLINDER);
  107. engine->RegisterEnumValue("ShapeType", "SHAPE_TRIANGLEMESH", SHAPE_TRIANGLEMESH);
  108. engine->RegisterEnumValue("ShapeType", "SHAPE_HEIGHTFIELD", SHAPE_HEIGHTFIELD);
  109. engine->RegisterEnumValue("ShapeType", "SHAPE_CONVEXHULL", SHAPE_CONVEXHULL);
  110. RegisterComponent<CollisionShape>(engine, "CollisionShape");
  111. engine->RegisterObjectMethod("CollisionShape", "void Clear()", asMETHOD(CollisionShape, Clear), asCALL_THISCALL);
  112. engine->RegisterObjectMethod("CollisionShape", "void SetSphere(float, const Vector3&in, const Quaternion&in)", asMETHOD(CollisionShape, SetSphere), asCALL_THISCALL);
  113. engine->RegisterObjectMethod("CollisionShape", "void SetBox(const Vector3&in, const Vector3&in, const Quaternion&in)", asMETHOD(CollisionShape, SetBox), asCALL_THISCALL);
  114. engine->RegisterObjectMethod("CollisionShape", "void SetCylinder(float, float, const Vector3&in, const Quaternion&in)", asMETHOD(CollisionShape, SetCylinder), asCALL_THISCALL);
  115. engine->RegisterObjectMethod("CollisionShape", "void SetCapsule(float, float, const Vector3&in, const Quaternion&in)", asMETHOD(CollisionShape, SetCapsule), asCALL_THISCALL);
  116. engine->RegisterObjectMethod("CollisionShape", "void SetTriangleMesh(Model@+, uint, const Vector3&in, const Quaternion&in)", asMETHOD(CollisionShape, SetTriangleMesh), asCALL_THISCALL);
  117. engine->RegisterObjectMethod("CollisionShape", "void SetHeightfield(Model@+, const IntVector2&in, float, uint, const Vector3&in, const Quaternion&in)", asMETHOD(CollisionShape, SetHeightfield), asCALL_THISCALL);
  118. engine->RegisterObjectMethod("CollisionShape", "void SetConvexHull(Model@+, float, uint, const Vector3&in, const Quaternion&in)", asMETHOD(CollisionShape, SetConvexHull), asCALL_THISCALL);
  119. engine->RegisterObjectMethod("CollisionShape", "void SetTransform(const Vector3&in, const Quaternion&in)", asMETHOD(CollisionShape, SetTransform), asCALL_THISCALL);
  120. engine->RegisterObjectMethod("CollisionShape", "Model@+ get_model()", asMETHOD(CollisionShape, GetModel), asCALL_THISCALL);
  121. engine->RegisterObjectMethod("CollisionShape", "ShapeType get_shapeType()", asMETHOD(CollisionShape, GetShapeType), asCALL_THISCALL);
  122. engine->RegisterObjectMethod("CollisionShape", "void set_position(const Vector3&in)", asMETHOD(CollisionShape, SetPosition), asCALL_THISCALL);
  123. engine->RegisterObjectMethod("CollisionShape", "const Vector3& get_position() const", asMETHOD(CollisionShape, GetPosition), asCALL_THISCALL);
  124. engine->RegisterObjectMethod("CollisionShape", "void set_rotation(const Quaternion&in)", asMETHOD(CollisionShape, SetRotation), asCALL_THISCALL);
  125. engine->RegisterObjectMethod("CollisionShape", "const Quaternion& get_rotation() const", asMETHOD(CollisionShape, GetRotation), asCALL_THISCALL);
  126. engine->RegisterObjectMethod("CollisionShape", "void set_collisionGroup(uint)", asMETHOD(CollisionShape, SetCollisionGroup), asCALL_THISCALL);
  127. engine->RegisterObjectMethod("CollisionShape", "uint get_collisionGroup() const", asMETHOD(CollisionShape, GetCollisionGroup), asCALL_THISCALL);
  128. engine->RegisterObjectMethod("CollisionShape", "void set_collisionMask(uint)", asMETHOD(CollisionShape, SetCollisionMask), asCALL_THISCALL);
  129. engine->RegisterObjectMethod("CollisionShape", "uint get_collisionMask() const", asMETHOD(CollisionShape, GetCollisionMask), asCALL_THISCALL);
  130. engine->RegisterObjectMethod("CollisionShape", "void set_friction(float)", asMETHOD(CollisionShape, SetFriction), asCALL_THISCALL);
  131. engine->RegisterObjectMethod("CollisionShape", "float get_friction()", asMETHOD(CollisionShape, GetFriction), asCALL_THISCALL);
  132. engine->RegisterObjectMethod("CollisionShape", "void set_bounce(float)", asMETHOD(CollisionShape, SetBounce), asCALL_THISCALL);
  133. engine->RegisterObjectMethod("CollisionShape", "float get_bounce()", asMETHOD(CollisionShape, GetBounce), asCALL_THISCALL);
  134. // Register Variant GetPtr() for CollisionShape
  135. engine->RegisterObjectMethod("Variant", "CollisionShape@+ GetCollisionShape() const", asFUNCTION(GetVariantPtr<CollisionShape>), asCALL_CDECL_OBJLAST);
  136. }
  137. static void RegisterRigidBody(asIScriptEngine* engine)
  138. {
  139. RegisterComponent<RigidBody>(engine, "RigidBody");
  140. engine->RegisterObjectMethod("RigidBody", "void SetTransform(const Vector3&in, const Quaternion&in)", asMETHOD(RigidBody, SetTransform), asCALL_THISCALL);
  141. engine->RegisterObjectMethod("RigidBody", "void ApplyForce(const Vector3&in)", asMETHOD(RigidBody, ApplyForce), asCALL_THISCALL);
  142. engine->RegisterObjectMethod("RigidBody", "void ApplyForceAtPosition(const Vector3&in, const Vector3&in)", asMETHOD(RigidBody, ApplyForceAtPosition), asCALL_THISCALL);
  143. engine->RegisterObjectMethod("RigidBody", "void ApplyTorque(const Vector3&in)", asMETHOD(RigidBody, ApplyTorque), asCALL_THISCALL);
  144. engine->RegisterObjectMethod("RigidBody", "void ResetForces()", asMETHOD(RigidBody, ResetForces), asCALL_THISCALL);
  145. engine->RegisterObjectMethod("RigidBody", "void set_mass(float)", asMETHOD(RigidBody, SetMass), asCALL_THISCALL);
  146. engine->RegisterObjectMethod("RigidBody", "float get_mass() const", asMETHOD(RigidBody, GetMass), asCALL_THISCALL);
  147. engine->RegisterObjectMethod("RigidBody", "void set_linearVelocity(Vector3)", asMETHOD(RigidBody, SetLinearVelocity), asCALL_THISCALL);
  148. engine->RegisterObjectMethod("RigidBody", "Vector3 get_linearVelocity() const", asMETHOD(RigidBody, GetLinearVelocity), asCALL_THISCALL);
  149. engine->RegisterObjectMethod("RigidBody", "void set_linearRestThreshold(float)", asMETHOD(RigidBody, SetLinearRestThreshold), asCALL_THISCALL);
  150. engine->RegisterObjectMethod("RigidBody", "float get_linearRestThreshold() const", asMETHOD(RigidBody, GetLinearRestThreshold), asCALL_THISCALL);
  151. engine->RegisterObjectMethod("RigidBody", "void set_angularVelocity(Vector3)", asMETHOD(RigidBody, SetAngularVelocity), asCALL_THISCALL);
  152. engine->RegisterObjectMethod("RigidBody", "Vector3 get_angularVelocity() const", asMETHOD(RigidBody, GetAngularVelocity), asCALL_THISCALL);
  153. engine->RegisterObjectMethod("RigidBody", "void set_angularRestThreshold(float)", asMETHOD(RigidBody, SetAngularRestThreshold), asCALL_THISCALL);
  154. engine->RegisterObjectMethod("RigidBody", "float get_angularRestThreshold() const", asMETHOD(RigidBody, GetAngularRestThreshold), asCALL_THISCALL);
  155. engine->RegisterObjectMethod("RigidBody", "void set_angularMaxVelocity(float)", asMETHOD(RigidBody, SetAngularMaxVelocity), asCALL_THISCALL);
  156. engine->RegisterObjectMethod("RigidBody", "float get_angularMaxVelocity() const", asMETHOD(RigidBody, GetAngularMaxVelocity), asCALL_THISCALL);
  157. engine->RegisterObjectMethod("RigidBody", "void set_active(bool)", asMETHOD(RigidBody, SetActive), asCALL_THISCALL);
  158. engine->RegisterObjectMethod("RigidBody", "bool get_active() const", asMETHOD(RigidBody, IsActive), asCALL_THISCALL);
  159. engine->RegisterObjectMethod("RigidBody", "void set_position(Vector3)", asMETHOD(RigidBody, SetPosition), asCALL_THISCALL);
  160. engine->RegisterObjectMethod("RigidBody", "Vector3 get_position() const", asMETHOD(RigidBody, GetPosition), asCALL_THISCALL);
  161. engine->RegisterObjectMethod("RigidBody", "void set_rotation(Quaternion)", asMETHOD(RigidBody, SetRotation), asCALL_THISCALL);
  162. engine->RegisterObjectMethod("RigidBody", "Quaternion get_rotation() const", asMETHOD(RigidBody, GetRotation), asCALL_THISCALL);
  163. engine->RegisterObjectMethod("RigidBody", "void set_linearDampingThreshold(float)", asMETHOD(RigidBody, SetLinearDampingThreshold), asCALL_THISCALL);
  164. engine->RegisterObjectMethod("RigidBody", "float get_linearDampingThreshold() const", asMETHOD(RigidBody, GetLinearDampingThreshold), asCALL_THISCALL);
  165. engine->RegisterObjectMethod("RigidBody", "void set_linearDampingScale(float)", asMETHOD(RigidBody, SetLinearDampingScale), asCALL_THISCALL);
  166. engine->RegisterObjectMethod("RigidBody", "float get_linearDampingScale() const", asMETHOD(RigidBody, GetLinearDampingScale), asCALL_THISCALL);
  167. engine->RegisterObjectMethod("RigidBody", "void set_angularDampingThreshold(float)", asMETHOD(RigidBody, SetAngularDampingThreshold), asCALL_THISCALL);
  168. engine->RegisterObjectMethod("RigidBody", "float get_angularDampingThreshold() const", asMETHOD(RigidBody, GetAngularDampingThreshold), asCALL_THISCALL);
  169. engine->RegisterObjectMethod("RigidBody", "void set_angularDampingScale(float)", asMETHOD(RigidBody, SetAngularDampingScale), asCALL_THISCALL);
  170. engine->RegisterObjectMethod("RigidBody", "float get_angularDampingScale() const", asMETHOD(RigidBody, GetAngularDampingScale), asCALL_THISCALL);
  171. // Register Variant GetPtr() for RigidBody
  172. engine->RegisterObjectMethod("Variant", "RigidBody@+ GetRigidBody() const", asFUNCTION(GetVariantPtr<RigidBody>), asCALL_CDECL_OBJLAST);
  173. }
  174. static void RegisterJoint(asIScriptEngine* engine)
  175. {
  176. engine->RegisterEnum("JointType");
  177. engine->RegisterEnumValue("JointType", "JOINT_NONE", JOINT_NONE);
  178. engine->RegisterEnumValue("JointType", "JOINT_BALL", JOINT_BALL);
  179. engine->RegisterEnumValue("JointType", "JOINT_HINGE", JOINT_HINGE);
  180. RegisterComponent<Joint>(engine, "Joint");
  181. engine->RegisterObjectMethod("Joint", "void Clear()", asMETHOD(Joint, Clear), asCALL_THISCALL);
  182. engine->RegisterObjectMethod("Joint", "bool SetBall(const Vector3&in, RigidBody@+, RigidBody@+)", asMETHOD(Joint, SetBall), asCALL_THISCALL);
  183. engine->RegisterObjectMethod("Joint", "bool SetHinge(const Vector3&in, const Vector3&in, RigidBody@+, RigidBody@+)", asMETHOD(Joint, SetHinge), asCALL_THISCALL);
  184. engine->RegisterObjectMethod("Joint", "void set_position(Vector3)", asMETHOD(Joint, SetPosition), asCALL_THISCALL);
  185. engine->RegisterObjectMethod("Joint", "Vector3 get_position() const", asMETHOD(Joint, GetPosition), asCALL_THISCALL);
  186. engine->RegisterObjectMethod("Joint", "void set_axis(Vector3)", asMETHOD(Joint, SetAxis), asCALL_THISCALL);
  187. engine->RegisterObjectMethod("Joint", "Vector3 get_axis() const", asMETHOD(Joint, GetAxis), asCALL_THISCALL);
  188. engine->RegisterObjectMethod("Joint", "RigidBody@+ get_bodyA() const", asMETHOD(Joint, GetBodyA), asCALL_THISCALL);
  189. engine->RegisterObjectMethod("Joint", "RigidBody@+ get_bodyB() const", asMETHOD(Joint, GetBodyB), asCALL_THISCALL);
  190. engine->RegisterObjectMethod("Joint", "JointType get_jointType() const", asMETHOD(Joint, GetJointType), asCALL_THISCALL);
  191. }
  192. void RegisterPhysicsAPI(asIScriptEngine* engine)
  193. {
  194. RegisterPhysicsWorld(engine);
  195. RegisterCollisionShape(engine);
  196. RegisterRigidBody(engine);
  197. RegisterJoint(engine);
  198. }