Jump to content

Ragdoll Beta | Engine Leadwerks Lua Script | Newton System.


Yue
 Share

Recommended Posts


 

I have resumed the project to implement the ragdoll effect, and it is really working as expected. 

The joint is placed correctly with its respective rotation on the model. 

 

--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() == 2 then 
				self.player.meshPlayer:SetMass(0)
				self.player:SetPhysicsMode(Entity.RigidBodyPhysics)
				
				self.RPlayer:InitShapes()
				self.RPlayer:InitJoints()
				self.RPlayer:SetPositionBodys()
				self.RPlayer:SetRotationBodys()
			
				
			end
		end 
	end

 

image.thumb.png.b35569c22a923d9cfafafa2a022c8356.png

  • Like 1

 

 

Link to comment
Share on other sites

  • 3 weeks later...

 

I have to say that I have repeated the exercise over and over again to try to implement the rag doll effect. Each new attempt I make I notice certain details that cause an error and find a solution, this I think is the eighth development version of this. 

Possibly by the time I get it right the world will be over.


image.thumb.png.58296629bb863d773e2e8404026acff0.png

 

 

Link to comment
Share on other sites

I end this, I think one of the big flaws of the Newton physics engine is that the joint is created at a global level and not in local relation to the rotation to the parts that make up the joint. 

At the end of the day I think this is why we have no official support from the engine. 

I could try again, but this has me bored already. :D

 

 

Link to comment
Share on other sites

 

I don't want to give up, each time I do the process I am becoming more adept at Leadwerks articulations.

At this point I had to isolate the ragdoll creation process in a separate project.

The change in this attempt is that I create the joint system at the start of the game and then assign it to the model (in process). But for some reason the rotation works fine for me here. I go with the legs where I have always had the problem and apparently it is because of the rotation of the bones below the pelvis. 

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



 



s image.thumb.png.a995fed618c24d3af0c630b2a13a1bb8.png

 

 

Link to comment
Share on other sites

And this is where the problem is, in the legs, where the character jumps as if he was going to die ( xD ).

Any help, for some reason I think Leadwerks is slowly dying, in google search engine nothing relevant about the engine appears anymore as the community is already Ultraengine. ;( 

I guess I'm alone in this.

 

 

 

 

Link to comment
Share on other sites

image.thumb.png.466cf403db346ab649855045a6e4777c.png

 

I found the real hell of my problems, from the bottom of the pelvis of the model, the rotations the joints of the leg bones are different from the upper ones which are in a vector 3 of 0,0,0.

At this point I had only one option and that was to rotate those bones manually for each animation, but that would kick me in the balls. However after seeing this image certain moment trying to figure out what I can do, I have a possible solution, and that is to rotate the rigid body of the collider to match that rotation of those joints. Let's wait how this goes. 

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

	self.mLegR:SetRotation(self.bLegR:GetRotation(true))
	self.mLegL:SetRotation(self.bLegL:GetRotation(true))

I do this effectively before creating the shapes. 

 

 

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