Archived

This topic is now archived and is closed to further replies.

mickey

why doesn't my D3DXVec3Dot(...) equal 1.57..?

Recommended Posts

hiya, D3DXVECTOR3 v1(1.0f, 0.0f, 0.0f); D3DXVECTOR3 v2(0.0f, 1.0f, 0.0f); float answer = D3DXVec3Dot(&v1, &v2); why does answer equals zero? also, am doing that to check for collision, is that okey? many thanks, [edited by - mickey on October 21, 2002 12:42:08 PM]

Share this post


Link to post
Share on other sites
you''re taking a dot product of two perpendicular vectors, which will always be zero. to find a magnitude of the sum of the vectors, which is what you seem to be after, use sqrt(d3dxvec3lengthsq(&v1)+d3dxvec3lengthsq(&v2)).

Share this post


Link to post
Share on other sites
i always come across ''the dot product of two vectors can give us the angle in between'' shoot, i didn''t realize that the result(dot product) of this is what will help us to get the angle. all along i thought the dot product was the angle!

hehe thanks guys!

Share this post


Link to post
Share on other sites
Let's see... isn't it...

A.Dot(B) == A.Length() * B.Length() * cos(angle_between_them)

?

If that's true, then:

angle = acos(A.Dot(B) / (A.Length()*B.Length()) );


... I think.

[edited by - Nypyren on October 22, 2002 3:28:57 AM]

Share this post


Link to post
Share on other sites
uh did i get this thing right... this method of getting the dot product is not useful? dot = v1 * v2 = (vx1 * vx2) + (vy1 * vy2) ? we should be using the other method which nypyren said?

also, do i have to normalized the vector before getting their dot product because the dot product should only be between -1.0 to +1.0?

thanks,

Share this post


Link to post
Share on other sites