dennis Posted April 2, 2015 Posted April 2, 2015 Hey guys, How can I add a certain model like a weapon to a enemy character? cheers Quote
gamecreator Posted April 2, 2015 Posted April 2, 2015 http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entitysetparent-r187 Quote
dennis Posted April 3, 2015 Author Posted April 3, 2015 Attach it as a child to his arm bone. I'm working in update 3.5, so it won't work :/ http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/entity/entitysetparent-r187 Hmm, thanks! will take a look at it Quote
Genebris Posted April 3, 2015 Posted April 3, 2015 Maybe I'm missing something, but how can most basic and most important function (parenting one object to another) not work in 3.5? Quote
dennis Posted April 3, 2015 Author Posted April 3, 2015 I can't see the bones to parent it to. But I need to parent one bone to another like a gun or assault rifle. I thought ypu where talkong talking about thwthe editor Quote
Genebris Posted April 3, 2015 Posted April 3, 2015 How will you find a position where you need to place your weapon relatively to bone without editor? Quote
josk Posted April 3, 2015 Posted April 3, 2015 I just started a 3rd person type project and used the following code to attach a weapon to the players arm. Add code to script attached to weapon. Adjust SetPosition and Setrotation as needed. Script.Target = nil--entity "Player" Script.gc = "" function Script:Start() self.gc = self.Target:FindChild("rHand") -- rHand is whatever name of bone local gun = self.gc:GetPosition() self.entity:SetParent(self.gc) self.entity:SetPosition(gun.x-11,gun.y-2,gun.z+6) self.entity:SetRotation(gun.x-110,gun.y,gun.z) end Didn't the Scene tree use to show the model Hierarchy? Could just drag the weapon to the bone then. Quote Elite Cobra Squad
dennis Posted April 3, 2015 Author Posted April 3, 2015 I just started a 3rd person type project and used the following code to attach a weapon to the players arm. Add code to script attached to weapon. Adjust SetPosition and Setrotation as needed. Script.Target = nil--entity "Player" Script.gc = "" function Script:Start() self.gc = self.Target:FindChild("rHand") -- rHand is whatever name of bone local gun = self.gc:GetPosition() self.entity:SetParent(self.gc) self.entity:SetPosition(gun.x-11,gun.y-2,gun.z+6) self.entity:SetRotation(gun.x-110,gun.y,gun.z) end Didn't the Scene tree use to show the model Hierarchy? Could just drag the weapon to the bone then. GheGhe yea true, But it is disabled since update 3.5, will try out the gun script Quote
Recommended Posts
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.