MCPcopy Create free account
hub / github.com/defold/defold / Physics_DestroyJoint

Function Physics_DestroyJoint

engine/gamesys/src/gamesys/scripts/script_physics.cpp:745–763  ·  view source on GitHub ↗

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 *

Source from the content-addressed store, hash-verified

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 *

Callers

nothing calls this directly

Calls 5

CheckHashOrStringFunction · 0.85
GetCollectionFunction · 0.85
CheckGoInstanceFunction · 0.85
DestroyJointFunction · 0.85
GetCollisionObjectFunction · 0.70

Tested by

no test coverage detected