Slimwaffle Posted December 24, 2018 Share Posted December 24, 2018 Hey guys and girls So in preparation for 4.6 and multiplayer functionality to leadwerks. I have been thinking about my game and how to prep it. I have decided to use the existing FPS script but add a character model and animations for walking crouching running etc. What I want to know is that when it comes to the weapons, is there a way to do this where the weapons are a child of the character? So that way I can keep the existing fps code and just remove the arms from the weapons models and then just position the guns as children of the characters hands or arms. Are there any examples of something similar being done before? Also when the multi player stuff is added will there be a function like update world that works for the multiplayer calls? Quote Link to comment Share on other sites More sharing options...
Slimwaffle Posted December 30, 2018 Author Share Posted December 30, 2018 bump Quote Link to comment Share on other sites More sharing options...
Jazz Posted December 31, 2018 Share Posted December 31, 2018 Here's the function for the staff I did in this old video. Offsets were trial and error and need changing for each model. It's called in UpdateWorld() That was my only attempt so there's probably a better way. function Script:AttachWeapon() if self.fingerBone == nil then self.fingerBone = self.entity:FindChild("Bone R Finger11") if self.fingerBone == nil then Debug:Error("Finger bone to attach weapon to not found.") end end local fingerPos = self.fingerBone:GetPosition(true) local fingerRot = self.entity:GetRotation(true) local tscale = self.entity:GetScale() local fPos = Transform:Point(0.01 / tscale.x, .02 / tscale.y, .03 / tscale.z, self.fingerBone, nil) --offset playerInfo[ourID].weaponEntity:SetPosition(fPos.x, fPos.y, fPos.z, true) playerInfo[ourID].weaponEntity:SetRotation(fingerRot.x-23, fingerRot.y, fingerRot.z, true) end 1 Quote --- Scott Using Windows 7 Ultimate 64 bit/Core I7-2700K @ 4312mhz/24G RAM/Nvidia GTX 1060 Link to comment Share on other sites More sharing options...
Slimwaffle Posted December 31, 2018 Author Share Posted December 31, 2018 Awesome thanks mate I will let you know how I go with it. Quote Link to comment Share on other sites More sharing options...
ZioRed Posted January 3, 2019 Share Posted January 3, 2019 Once you know what entity is the hand bone, I would use SetParent to make the weapon as child (and set offset local position) to set its position only once instead of repositioning it in each UpdateWorld call. If you're using LUA then I would suggest to have a public string property to store the name of the hand bone (you could even think to store names as hierarchy tree, for example "Spine/Chest/Right Arm/Hand" and then splitting by "/" to get it if your model has two entities "Hand" instead of "Hand R/Hand L") and one vector3 property to store the offset local position for the weapon (since these values could easily be different for each model). Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
Admin Posted January 3, 2019 Share Posted January 3, 2019 For syncing animation, there will be some new functions that save and load the entity animation stacks. Quote Link to comment Share on other sites More sharing options...
Admin Posted January 3, 2019 Share Posted January 3, 2019 @ZioRed why does your avatar say "Senior Programmer" above it? ? 1 1 Quote Link to comment Share on other sites More sharing options...
ZioRed Posted January 4, 2019 Share Posted January 4, 2019 On 1/3/2019 at 9:13 PM, Admin said: @ZioRed why does your avatar say "Senior Programmer" above it? ? I don't know, it's you the admin lol, I cannot edit my Rank in Edit Profile ? 1 Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
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.