Rick Posted December 22, 2013 Posted December 22, 2013 When my character is strafing and moving I want to rotate the hip bone by 45 degrees and the spine bone 15 degrees. So I find these bones and after the correct animation is played I do the rotation but the bones never rotate. It looks to me that the animation is overriding my bone rotation. How can I do this manual bone rotation while still playing animations? Quote
bandrewk Posted December 23, 2013 Posted December 23, 2013 Hello Rick, how are you applying the rotation? It seems to work fine for me. I apply the rotation right after updating the animation. Quote
Rick Posted December 23, 2013 Author Posted December 23, 2013 I must be doing something wrong then. Here is the chunk of code I have. The idea is if I'm running forward and strafing, to rotate the hips. if self.moveDir == self.dir.Forward then if self.shooting == true then self.animMgr:SetAnimationSequence(self.seq.RunShoot, .5, 100) self.animMgr:SetAnimationSequence(self.seq.ShootStand, 3, 0, self.spine) else self.animMgr:SetAnimationSequence(self.seq.Run, .5, 100) end -- this might not be needed but it rotates hips when moving diagonally if self.strafeDir == self.dir.Left then self.hips:SetRotation(Vec3(0, -45, 0), false) elseif self.strafeDir == self.dir.Right then self.hips:SetRotation(Vec3(0, 45, 0), false) end end Quote
Rick Posted December 23, 2013 Author Posted December 23, 2013 Making a new post because if I edit the above the stupid code formatting goes away and I'm not indenting it again If I comment out the animation lines then the lower body does rotate. So I'm taking the assumption it's not rotating because of the animation. Quote
bandrewk Posted December 23, 2013 Posted December 23, 2013 Although I'm using c++, my code looks very similar to yours: __super::UpdateAnimation(this); Leadwerks::Entity* ent = model->FindChild("Bip01_Spine1"); if (ent) { ent->SetRotation(Vec3(0,0,rotation.x), false); } I can't spot anything wrong within your code, maybe this is something lua specific. 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.