Jump to content
  • Advertisement
Sign in to follow this  
Michael Guerra

c++ weapon aiming Havok animation IK

This topic is 1100 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello,

 

Im programing a fps game, currently im using havok SDK animation and physics 2014.1 for VS 2012, Im programing the weapon aiming of the character, the character is exported from 3d max 2015 (animation, skeleton, skin and ragdoll), the model is master chief (Halo 2), and the weapon is the covenant carbine this for now  while build the game engine. In the scene I have partitioned the skeleton in 2 parts; root, pelvis and legs are partition 1 and the other bones are the partition 2, I have attached the weapon to the right hand using hkTransform and hkaPose ( getting the transform of the right hand's bone and multiplying by the character transform and weapon offset transform) to place the weapon in the correct posicion and rotation, all until here its fine, but now I want to know how to align the weapon to a target moving/rotating the right hand with IK solutions (maybe hkaTwoJointsIkSolver), and lock the left hand to the weapon based on a frame of the same weapon, (I've tried to do it with hkaTwoJointsIkSolver in the initial pose, but when i move the hand up or down the left arm loses his correct transform maybe because I dont know how to setup correctly the IK ), and I don know how to apply IK to spine to rotate,

 

would really appreciate your help , thank you.

 
 
 

Share this post


Link to post
Share on other sites
Advertisement

ok, 

I've been reading some articles and I could understandtle a little more about Havok's IK, now lets leave Havok in other place.

 

The question here is how to calculate/compute the left hand rotation to make seems that the left hand holds the weapon (weapon attached to right hand), in the code, the position of the left hand is determinated by a weapon frame called leftHand, 

 

when i move the weapon's target now the right hand moves correctly,but now that the transform of weapon's frame has changed the left hand rotation is not the correct to make seems that the left hand holds the weapon:

 

this is the code to set the rotation

 

// m_weaponTransform:  the weapon transfrom (RHandBone * CharacterTransform);

 

Quaternion m_weaponLHandRot;

Transform wpLHand;

wpLHand.setMul(m_weaponTransform, m_weaponPose->getBoneModelSpace(m_weaponlHand)); // gets the weapon frame called leftHand and multiply by weapon transform and sets the result value to wpLHand (the left hand position) 

m_weaponLHandRot.addMul(1.0f, wpLHand.m_rotation); // adds the current rotation of weapon to left hand rotation

 

but I could not resolve the formula for these rotation.

 

would really appreciate any help , thank you.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!