destroy a physics joint * * Destroy an already physics joint. The joint has to be created before a * destroy can be issued. * * Note: Currently only supported in 2D physics. * * @name physics.destroy_joint * @param collisionobject [type:string|hash|url] collision object where the joint exist * @param joint_id [type:string|hash] id of the joint *
| 743 | * |
| 744 | */ |
| 745 | static int Physics_DestroyJoint(lua_State* L) |
| 746 | { |
| 747 | DM_LUA_STACK_CHECK(L, 0); |
| 748 | |
| 749 | dmhash_t joint_id = dmScript::CheckHashOrString(L, 2); |
| 750 | dmGameObject::HCollection collection = dmGameObject::GetCollection(CheckGoInstance(L)); |
| 751 | |
| 752 | CollisionComponent* comp = 0x0; |
| 753 | CollisionWorld* comp_world = 0x0; |
| 754 | GetCollisionObject(L, 1, collection, &comp, &comp_world); |
| 755 | |
| 756 | // Unpack type specific joint connection paramaters |
| 757 | dmPhysics::JointResult r = dmGameSystem::DestroyJoint(comp_world, comp, joint_id); |
| 758 | if (r != dmPhysics::RESULT_OK) { |
| 759 | return DM_LUA_ERROR("could not disconnect joint: %s (%d)", PhysicsResultString[r], r); |
| 760 | } |
| 761 | |
| 762 | return 0; |
| 763 | } |
| 764 | |
| 765 | /*# get properties for a joint |
| 766 | * |
nothing calls this directly
no test coverage detected