RID PhysicsServerSW::damped_spring_joint_create(const Vector3& p_anchor_a,const Vector3& p_anchor_b,RID p_body_a,RID p_body_b) { BodySW *A=body_owner.get(p_body_a); ERR_FAIL_COND_V(!A,RID()); BodySW *B=body_owner.get(p_body_b); ERR_FAIL_COND_V(!B,RID()); JointSW *joint = memnew( DampedSpringJointSW(p_anchor_a,p_anchor_b,A,B) ); RID self = joint_owner.make_rid(joint); joint->set_self(self); return self; }
RID PhysicsServerSW::pin_joint_create(const Vector3& p_pos,RID p_body_a,RID p_body_b) { BodySW *A=body_owner.get(p_body_a); ERR_FAIL_COND_V(!A,RID()); BodySW *B=NULL; if (body_owner.owns(p_body_b)) { B=body_owner.get(p_body_b); ERR_FAIL_COND_V(!B,RID()); } JointSW *joint = memnew( PinJointSW(p_pos,A,B) ); RID self = joint_owner.make_rid(joint); joint->set_self(self); return self; }
RID PhysicsServerSW::groove_joint_create(const Vector3& p_a_groove1,const Vector3& p_a_groove2, const Vector3& p_b_anchor, RID p_body_a,RID p_body_b) { BodySW *A=body_owner.get(p_body_a); ERR_FAIL_COND_V(!A,RID()); BodySW *B=body_owner.get(p_body_b); ERR_FAIL_COND_V(!B,RID()); JointSW *joint = memnew( GrooveJointSW(p_a_groove1,p_a_groove2,p_b_anchor,A,B) ); RID self = joint_owner.make_rid(joint); joint->set_self(self); return self; }
RID PhysicsServerSW::joint_create_pin(RID p_body_A,const Vector3& p_local_A,RID p_body_B,const Vector3& p_local_B) { BodySW *body_A = body_owner.get(p_body_A); ERR_FAIL_COND_V(!body_A,RID()); if (!p_body_B.is_valid()) { ERR_FAIL_COND_V(!body_A->get_space(),RID()); p_body_B=body_A->get_space()->get_static_global_body(); } BodySW *body_B = body_owner.get(p_body_B); ERR_FAIL_COND_V(!body_B,RID()); ERR_FAIL_COND_V(body_A==body_B,RID()); JointSW *joint = memnew( PinJointSW(body_A,p_local_A,body_B,p_local_B) ); RID rid = joint_owner.make_rid(joint); joint->set_self(rid); return rid; }
RID PhysicsServerSW::joint_create_generic_6dof(RID p_body_A,const Transform& p_local_frame_A,RID p_body_B,const Transform& p_local_frame_B) { BodySW *body_A = body_owner.get(p_body_A); ERR_FAIL_COND_V(!body_A,RID()); if (!p_body_B.is_valid()) { ERR_FAIL_COND_V(!body_A->get_space(),RID()); p_body_B=body_A->get_space()->get_static_global_body(); } BodySW *body_B = body_owner.get(p_body_B); ERR_FAIL_COND_V(!body_B,RID()); ERR_FAIL_COND_V(body_A==body_B,RID()); JointSW *joint = memnew( Generic6DOFJointSW(body_A,body_B,p_local_frame_A,p_local_frame_B,true) ); RID rid = joint_owner.make_rid(joint); joint->set_self(rid); return rid; }