Original Post
Hey guys,
I am trying to do the object manipulation of the character in the game that I'm currently working on. So, the object should always face the character while it is being carried. In order to this, I can easily set the rotation of the object to the rotation of the character. But Havok physics don't work this way, and whenever there is collision, physics would freak out.
In order for physics to work smoothly, I would get the current rotation of the object which is in quaternions. Then I would know my desired rotation in quaternion based on the rotation of the camera, and then I would apply angular impulse to the object in a way that it goes from current quaternion to desired quaternion.
The problem here is that ApplyAngularImpulse in havok gets euler angles as argument. So, what I did was that I converted the current and desired quaternions to Euler Angles, and then I substracted them, and applied the agular impulse to the object. (Of course I damped it so that it would stop in the desired rotation). However, this method only works for half of the space. Because when you convert from quaternions to euler angles, for half of the space it changes continiously, but for the other half, there are gaps between different parts of the space. So the object would rotate smoothly on the one half, but on the other, it wouldn't know which way to rotate because of those gaps.
I also have tried getting the quaternion that goes from current quaternion to the desired one, and then converting it to euler, and applying angular impulse based on that, but that also has a similar kind of problem.
I am really stuck here, and don't know what to do at this point. If anyone can point me in the right direction, I would really appreciate it.
Thank you.
I am trying to do the object manipulation of the character in the game that I'm currently working on. So, the object should always face the character while it is being carried. In order to this, I can easily set the rotation of the object to the rotation of the character. But Havok physics don't work this way, and whenever there is collision, physics would freak out.
In order for physics to work smoothly, I would get the current rotation of the object which is in quaternions. Then I would know my desired rotation in quaternion based on the rotation of the camera, and then I would apply angular impulse to the object in a way that it goes from current quaternion to desired quaternion.
The problem here is that ApplyAngularImpulse in havok gets euler angles as argument. So, what I did was that I converted the current and desired quaternions to Euler Angles, and then I substracted them, and applied the agular impulse to the object. (Of course I damped it so that it would stop in the desired rotation). However, this method only works for half of the space. Because when you convert from quaternions to euler angles, for half of the space it changes continiously, but for the other half, there are gaps between different parts of the space. So the object would rotate smoothly on the one half, but on the other, it wouldn't know which way to rotate because of those gaps.
I also have tried getting the quaternion that goes from current quaternion to the desired one, and then converting it to euler, and applying angular impulse based on that, but that also has a similar kind of problem.
I am really stuck here, and don't know what to do at this point. If anyone can point me in the right direction, I would really appreciate it.
Thank you.