Jump to content

Ragdoll Problem


Yue
 Share

Recommended Posts

Hi, I am trying to create a simple ragdoll effect on a column.
image.thumb.png.f012c4495f6db48a97aa57012b3cf4fb.png

 

The idea is to assign to those bones a solid body, which I have referenced in green and red, where each one goes in the respective bone. 
image.thumb.png.93c6f742379464d0c5152436f4a4f1c0.png

 

 

When I run the program, I move the colored bodies to the position of each bone, and then I add mass to those bodies and tell the bones that their parents are those colored bodies. 

Everything works partly well.


 

Script.bodyHead = nil --Entity "Body Head"
Script.bodyFeet = nil --Entity "Body Feet"

function Script:Start()
	

--Column
self.boneHead = self.entity:FindChild("Bone1")
self.boneFeet = self.entity:FindChild("Bone")


self.bodyHead:SetMass(0)
self.bodyFeet:SetMass(0)

self.r = false
end



function Script:UpdateWorld()
	
	
	
if Window:GetCurrent():KeyHit(Key.R) then

	if self. r == false then 
		self.bodyHead:SetPosition(self.boneHead:GetPosition(true))
		self.bodyFeet:SetPosition(self.boneFeet:GetPosition(true))


	

		self.boneHead:SetParent(self.bodyHead)
		self.boneFeet:SetParent(self.bodyFeet)
		self.r = true
	end

	end
	
	if Window:GetCurrent():KeyHit(Key.T) then 
		if self.r == true then 


	self.bodyHead:SetMass(1.0)
	self.bodyFeet:SetMass(1.0)
			
			
		end
	end


end

 

The spine body falls in the direction of the force of gravity, since the two bones follow the position of the colored rigid bodies. The problem is that depending on a certain movement of the camera the column disappears. 

I am grateful for any suggestions.   So with that taken care of, I would have to think about joints.
 

 

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...