Jump to content

How can I prevent two parts from colliding in a joint?


Yue
 Share

Recommended Posts

  • 2 weeks later...
On 1/2/2022 at 6:12 AM, Josh said:

Two entities that are connected with a joint will not collide with each other.

Your comment is spot on.  What happens is that by moving the rigid bodies to the joints of the character, there is a clash between several pieces while creating the joints. 

In this case, setting the collision to debris type solves the problem. 

Another issue is that I have problems with the rotations of the bone reticulations and the rotation of the rigid body, for some reason it doesn't match.

Translated with www.DeepL.com/Translator (free version)

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

If you are creating a hinge joint, the starting orientation is an angle of zero. There is no correlation between the entity rotations and the joint angle.

  • Like 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

6 hours ago, Josh said:

Are you using SetMatrix()? You should probably just use SetPosition and SetRotation (using a quaternion) to avoid any problems with scaling.

What I am doing is taking the bone of the foot and telling it to be son of the rigid body for the ragdoll effect of the foot. 

Then I have found solution to the problem, and that is that it is the respective rotation of the bone I have to set it to 0,0,0 locally. 

 

--Test Ragdoll.
	if Input:GetKeyHit(Key.R) and self.ragdoll == false then 
		self.ragdoll = true
		
		if self.ragdoll == true and self.player:GetPhysicsMode() ~=  Entity.RigidBodyPhysics then 
			if self.player:GetPhysicsMode() == Entity.CharacterPhysics then 
				self.player.meshPlayer:SetMass(0)
				self.player:SetPhysicsMode(Entity.RigidBodyPhysics)
				
				self.RPlayer:InitShapes()
				self.RPlayer:InitJoints()
				self.RPlayer:SetRotations(true)	
				self.RPlayer:SetPositions()
				
				self.RPlayer:SetParents()
				self.RPlayer:SetMass(10)
					
			end
		end 
	end

The above script is the prototype to activate the ragdoll effect, I am using the SetRotation and SetPosition.  

 

Mars.jpg.89ab63a64eebc1f5ada0ab82b66a1f8c.jpg

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...