- #1
blackwind
- 5
- 0
Hi,
I hope this is the right forum to post.
My question is, which is the math implied for transforming an objectA local space, to anothers objects local space, and then transforming it to world space?
For example,
Lets say we want to know if objectA is infront of objectB,
So the logic is to convert the objectB position into objectsA local space, so we get a new point(x,y,z). Now, we only need to know if the new "z" values is greater than 0 (assuming in front is represented by the positive z values).
Thats easy. My problem is that i don't really get the math.
For example, let's say we have our objectA at point (5,0,0) in world space.
and our objectB at (10,5,2) in world space.
Before continuing, we rotate our objectA by 90 degrees around Y axis counterclockwise. (So the point would be (0,0,-5) in object space)
Being said that, what's the math involved to get the objectB point position transformed into objectA object space?
By using some game software, The result is (-2,5,5).
Which comes from rotating ObjectA(5,0,05) and gives us (0,0,-5). The we use a "kind" of version of the rotated objectB (-2,5,10). And then we do the addition.
It almost makes sense to me, except that the objectB original point (10,5,2) rotated 90 degrees gives us (2,5,-10). Why do they use (-2,5,10) instead?
A similar problem is for the opposite operation.
Lets say we want to transform the ObjectB point position (10,5,2) relative to ObjectA objects space to world position.
i got that the result is (7,5,-10). Which i 'almost' understand.
Since ObjectB (10,5,2) rotated by 90degrees is (2,5,-10). And then a simple addition of the original (5,0,0) + (2,5,-10) will give us the result (7,5,-10).
What i don't understand is.. why?
Why do we use the unrotated ObjectA point, and the rotated ObjectB point? Why not both rotated points? Or why not both unrotated points?
What is the formula? Whats the real math behind?
Hope i make my self clear.
Thank you!
I hope this is the right forum to post.
My question is, which is the math implied for transforming an objectA local space, to anothers objects local space, and then transforming it to world space?
For example,
Lets say we want to know if objectA is infront of objectB,
So the logic is to convert the objectB position into objectsA local space, so we get a new point(x,y,z). Now, we only need to know if the new "z" values is greater than 0 (assuming in front is represented by the positive z values).
Thats easy. My problem is that i don't really get the math.
For example, let's say we have our objectA at point (5,0,0) in world space.
and our objectB at (10,5,2) in world space.
Before continuing, we rotate our objectA by 90 degrees around Y axis counterclockwise. (So the point would be (0,0,-5) in object space)
Being said that, what's the math involved to get the objectB point position transformed into objectA object space?
By using some game software, The result is (-2,5,5).
Which comes from rotating ObjectA(5,0,05) and gives us (0,0,-5). The we use a "kind" of version of the rotated objectB (-2,5,10). And then we do the addition.
It almost makes sense to me, except that the objectB original point (10,5,2) rotated 90 degrees gives us (2,5,-10). Why do they use (-2,5,10) instead?
A similar problem is for the opposite operation.
Lets say we want to transform the ObjectB point position (10,5,2) relative to ObjectA objects space to world position.
i got that the result is (7,5,-10). Which i 'almost' understand.
Since ObjectB (10,5,2) rotated by 90degrees is (2,5,-10). And then a simple addition of the original (5,0,0) + (2,5,-10) will give us the result (7,5,-10).
What i don't understand is.. why?
Why do we use the unrotated ObjectA point, and the rotated ObjectB point? Why not both rotated points? Or why not both unrotated points?
What is the formula? Whats the real math behind?
Hope i make my self clear.
Thank you!