YouGroove Posted March 22, 2013 Share Posted March 22, 2013 For Blender users : After a good bucnh of rotation trials on weapon export to FBX i found the good way to export it, so i share it for interested people. You need to make some bone special to handle the wapon on the hand like on the picture. Next the weapon must be aligned differently from axis compared to the model like on the picture also. By keeping that convention you will be able to place weapons or other stuff using only the SetMatrix() function directly (without offsets or rotation tweakings) The code in Lua is : Script.LeftHand = "Bone.003_L.004"--string --self.weapon = Model:Load("Models/other/weaponV5.mdl") Script.weap = Model:Load("Models/ff7.mdl") Script.weap:SetPosition(0,-100,0) function Script:UpdatePhysics() ... local child = self.entity:FindChild(self.LeftHand) mat = child:GetMatrix(); self.weap:SetMatrix(mat) Here is some ingame screenshot (it's not perfect caus weapon was placed approximatively , like the size, caus it's too big, and like the bone for weapon that was quickly made without taking care of good placement and rotation) Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Daimour Posted March 23, 2013 Share Posted March 23, 2013 I think it's better for perfomance to find the bone once and then store it in some variable. Not to look for it every update. local child = self.entity:FindChild(self.LeftHand) function Script:UpdatePhysics() ... mat = child:GetMatrix(); self.weap:SetMatrix(mat) Quote Link to comment Share on other sites More sharing options...
Rick Posted March 23, 2013 Share Posted March 23, 2013 Yeah, doing it in the Start() method would be better YouGroove. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted March 23, 2013 Author Share Posted March 23, 2013 Yes thanks, just to get the entity pointer, no need to call that every frame. Quote Stop toying and make games 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.