-
Posts
2,449 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Downloads
Everything posted by Yue
-
Script.bodyHead = nil --Entity "Body Head" Script.bodyFoot = nil --Entity "Body Foot" Script.r = false Script.joint = nil function Script:Start() self.boneHead = self.entity:FindChild("Bone1") self.boneFoot = self.entity:FindChild("Bone2") System:Print(self.boneHead) System:Print(self.boneFoot) end function Script:UpdateWorld() if self.r == false then if Window:GetCurrent():KeyHit(Key.R) then if self.joint then self.joint:Release() end self:SetPosition() self:SetRotation() self:CreateJoint() self:SetMass(1.0) --self.entity:Hide() end end --Rotate Player. if Window:GetCurrent():KeyHit(Key.G) then System:Print("Rotate") self.entity:SetRotation(0,-90,0) end if Window:GetCurrent():KeyDown(Key.Space) then self.bodyHead:AddForce(0,100,0) self.bodyFoot:AddForce(0,100,0) end end function Script:SetMass( mass ) self.bodyHead:SetMass( mass) self.bodyFoot:SetMass(mass) self.bodyHead:SetVelocity(0,1,0) self.bodyFoot:SetVelocity(0,1,0) end function Script:CreateJoint() self.joint = Joint:Hinge(self.bodyHead:GetPosition(true).x, self.bodyHead:GetPosition(true).y, self.bodyHead:GetPosition(true).z, 1,0,0, self.bodyFoot, self.bodyHead) --self.joint:EnableLimits() --self.joint:SetLimits(0,90) end function Script:SetPosition() self.bodyHead:SetPosition(self.boneHead:GetPosition(true),true) self.bodyFoot:SetPosition(self.boneFoot:GetPosition(true),true) end function Script:SetRotation() self.bodyHead:SetRotation(self.boneHead:GetRotation(true),true) self.bodyFoot:SetRotation(self.boneFoot:GetRotation(true),true) end I've turned this every which way, no matter what I do, the hinge revolves around the global coordinates, no matter what I turn the column that acts as a monicker for the ragdoll. Update Scripts. R key = activate ragdoll. Space key = add force to the bodies. G Key = Turn Player. ( only one turn ) ERagdoll.lua
-
Script.bodyHead = nil --Entity "Body Head" Script.bodyFoot = nil --Entity "Body Foot" Script.r = false Script.joint = nil function Script:Start() self.boneHead = self.entity:FindChild("Bone1") self.boneFoot = self.entity:FindChild("Bone2") System:Print(self.boneHead) System:Print(self.boneFoot) end function Script:UpdateWorld() if self.r == false then if Window:GetCurrent():KeyHit(Key.R) then self:SetPosition() self:SetRotation() self:CreateJoint() self:SetMass(1.0) self.entity:Hide() end end --Rotate Player. if Window:GetCurrent():KeyDown(Key.A) then System:Print("Rotate") self.entity:SetRotation(0,-90,0) end end function Script:SetMass( mass ) self.bodyHead:SetMass( mass) self.bodyFoot:SetMass(mass) end function Script:CreateJoint() self.joint = Joint:Hinge(self.bodyHead:GetPosition(true).x, self.bodyHead:GetPosition(true).y, self.bodyHead:GetPosition(true).z, 1,0,0, self.bodyFoot, self.bodyHead) self.joint:EnableLimits() self.joint:SetLimits(0,90) end function Script:SetPosition() self.bodyHead:SetPosition(self.boneHead:GetPosition(true),true) self.bodyFoot:SetPosition(self.boneFoot:GetPosition(true),true) end function Script:SetRotation() self.bodyHead:SetRotation(self.boneHead:GetRotation(true),true) self.bodyFoot:SetRotation(self.boneFoot:GetRotation(true),true) end It's definitely not working, I don't know what the real problem is, I'm missing something I don't know what it is. I create the joint, but the hinge always runs in global mode, at least from my point of view, even if I rotate the monkey. Scripts folder open. Laboratorio.zip
-
Script.bodyHead = nil --Entity "Body Head" Script.bodyFoot = nil --Entity "Body Foot" Script.r = false function Script:Start() self.boneHead = self.entity:FindChild("Bone1") self.boneFoot = self.entity:FindChild("Bone2") System:Print(self.boneHead) System:Print(self.boneFoot) end function Script:UpdateWorld() if self.r == false then if Window:GetCurrent():KeyHit(Key.R) then self:SetPosition() self:SetRotation() end end end function Script:SetPosition() self.bodyHead:SetPosition(self.boneHead:GetPosition(true),true) self.bodyFoot:SetPosition(self.boneFoot:GetPosition(true),true) end function Script:SetRotation() self.bodyHead:SetRotation(self.boneHead:GetRotation(true),true) self.bodyFoot:SetRotation(self.boneFoot:GetRotation(true),true) end here I position the rigid bodies in the position and rotation of the bones. This should be sufficient for when the model is pointed elsewhere. The next step is to create the single joint. Continue...
-
Recovering the bones of the monkey continue...
-
All set to covet a single joint Continue...
-
The first step, I built my monicker for a simple joint. Subsequently, I create rigid bodies for each bone. ( 2) Continue...
-
The translator doesn't help me much, I'll create a simple articulation and I'll let you know.
-
You give me a lot of encouragement, it's been a nice long road with Leadwerks, since the Blitz community disappeared, then I'm getting closer and closer to create a video game. And this ragdoll effect is very nice to implement the character death and standing up after the ragdoll effect. And my daughter is happy and gives me a lot of encouragement to make her video game where the character is her. Translated with www.DeepL.com/Translator (free version)
-
@Josh Any progress?
-
@Josh Thank you for your interest in this, I appreciate it very much. I've been looking at the standing animations depending on whether it lands on its back or with its chest against the ground.
-
The first video refers to when I use SetParent, this second one I am using SetPosition and SetRotation, because that would provide the possibility to run an animation after the ragdoll effect, but it does not work correctly. Regarding what you mention, I think I could make a simple example of a hinge joint doing the ragdoll effect on a worm. I think me without knowing that possibly the joints are missing a rotation value if it is global or local. And the position and rotation updates I have no idea. Translated with www.DeepL.com/Translator (free version) I will make a simple example of a union.
-
When you execute the ragdoll with the initial orientation it is executed correctly, its joints work correctly, the knee bends at the correct angle, but if you change the orientation of the model, to the right for example, the leg bends in the opposite position, because the joints have global rotations.
-
It is used for several things, for example to rotate the character in the direction in which the camera that follows the player is pointing and thus move in that direction. On the other hand it serves to orient the character when it is brought from an external program.
-
Mars.rar @Josh R key to activate Ragdoll, E key to reset the character, rotate the character with the mouse. Exposed Scripts directory to see its content.
-
Another drawback I have is that the joints rotate around the global coordinates, so no matter how much care I put into setting up the joints, the character in one direction executes the joints correctly, but if it is facing the other way, we have problems with one leg rotating in the opposite direction than normal. Perfect. Error.
-
Looking at the hierarchy of the bones, when we use SetParent(nil), what happens is that those bones are orphaned. In the hierarchy some of them are related and that is what breaks the skeleton. For that reason the most viable is to use SetPosition, GetRotation, but for some reason the update is imperfect, and you have death cramps which is not natural for the ragdoll effect. More likely for a horror scene, yes. Translated with www.DeepL.com/Translator (free version)
-
Yes, I have tried to use SetParent, nil, but it happens that the skeleton seems to be unhooked from the mesh, and from the character controller. The most viable would be to use SetPosition and GetPosition, but in what I have tried it is impossible.
-
What is the script command to change this value of an entity? https://media3.giphy.com/media/JoqBjd3dOdcPu/200.gifhttps://media4.giphy.com/media/3o9bJX4O9ShW1L32eY/200.gif
-
When I run the ragdoll with SetParen, assigning as parent of the bone the rigid body. The ragdoll looks decent. The thing is that when I finish the ragdoll, I can't use animations like standing up. The skeleton is already related to the rigid body. This could be done if I use SetPosition or SetRotation and for example the character is hit by a car and stands up, like in gta V, this is because the effect is finished and the skeleton responds to the animation, but with this method the character in full ragdoll has death cramps, it's like convulsing and it looks totally weird. So what is possible now is to use SetParent, but after the ragdoll effect, its death, I remove the mesh and load it again where the skeleton is perfect to resume animations. Translated with www.DeepL.com/Translator (free version) function Script:Detach() self.entity = Model:Load("Models/Player/Yue.mdl") self.entity:SetPosition(0,8,-5) self.entity:SetRotation(-45,0,0) self.entity:SetScript("Scripts/Player/EPlayer.lua") self.entity:SetShadowMode(Light.Dynamic) end