Jump to content
Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 31 October 2012 - 04:45 PM
Posted 31 October 2012 - 04:54 PM
Posted 31 October 2012 - 04:56 PM
Edited by luca-deltodesco, 31 October 2012 - 04:56 PM.
Posted 31 October 2012 - 05:07 PM
First calculate the cross-product between the original vector and the vector AB: that will give you an axis of rotation. Then calculate the dot-product between the original vector and the vector AB: that will give you the arccosine of the angle between them and consequently the angle to rotate.
That will give you the smallest possible rotation in order to rotate a vector from some original direction to the direction AB.
Posted 31 October 2012 - 05:21 PM
Posted 31 October 2012 - 05:22 PM
Posted 31 October 2012 - 05:36 PM
Posted 31 October 2012 - 06:08 PM
Posted 01 November 2012 - 02:26 AM
Posted 01 November 2012 - 02:33 AM
Posted 01 November 2012 - 03:13 AM
Posted 01 November 2012 - 05:06 AM
My solution is one way of doing it given the constraint I assumed. As has been said, you need to fix the problem that your direction vector does not correspond to an orientation. There are infinitely many orientations, and consequently infinitely many rotations that you can apply, that maps your original vector to the vector AB. You need additional information to reduce this set from infinity to one.
I think I understand what you mean, but then, I'd possibly solve this matter? Would the solution you provided in your first reply do it ? BTW, what means the "constraint was that it was the minimum possible rotation"?
Sorry for all these questions, it's just that I'm very bad at math and all these terms and notions puzzle me.
As has been said also, you only need two rotations but an ZXY order has three rotations. One rotation must be removed from the calculation or you have too many rotations to solve the problem. You could, for example, leave one of the rotations at zero degrees and calculate the other two. That will give you a unique solution. But the problem is that you have three angles and thus three ways to zero an angle, leaving you with three different solutions. Three different solutions that indeed give you three different orientations.
Well, changing SDK unfortunately is not an option
The order of rotation is ZXY.
I'm so bad at math that I'm really amazed to realize how something that I figured out a simple operation (place an object at the same base point of a guide, and orient it along it), instead seems to be so complicated.
I hope you guys can come up with a solution to help me with this.
Edited by Brother Bob, 01 November 2012 - 05:07 AM.
Posted 01 November 2012 - 06:09 AM
Edited by Alessandro, 01 November 2012 - 06:17 AM.
Posted 01 November 2012 - 06:23 AM
Posted 01 November 2012 - 07:32 AM
Posted 01 November 2012 - 09:10 AM
Posted 02 November 2012 - 01:00 AM
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.