Skip to main content
gamedev.net
🔒 Locked

Limiting Rotations...

Started by Axiverse Jun 11, 2004 at 8:28 PM 3 replies 350+ views
Original Post
Axiverse
Axiverse
I'm trying to limit the rotation of free moving bones... The bones that are in sockets have basically half a sphere that they can rotate in, I'm trying to figure out if a certain direction (theta, phi) is in that half shpere that it is allowed to be in. The half shpere is represented by another shpereical cordinate pointoing to the center... Any help? [Edit:] I guess I'm just trying to figure how to find the distance from one direction to another... How would you do this? [Edit Again...:] Would this work??? sqrt((theta1 - theta2)^2 + (phi1 - phi2)^2) ** modification of the distance formula =) [edited by - Axiverse on June 11, 2004 9:30:44 PM] [edited by - Axiverse on June 11, 2004 9:41:32 PM]
Samith
Samith
On a sphere, there is a great circle that goes through any two points. YOu'd have to find the angle of the great cirlce, then find the angle between the two points on that circle. Finding the angles is the hard part, and I don't know how to do that. But it might give you a heads up as to what you need to do. You might want to search Google about spherical geometry.

EDIT: In other words, find the angle between the two points and calculate the arc-length.

[edited by - Samith on June 11, 2004 10:07:50 PM]
Axiverse
Axiverse
Yes, i tried the convert to caspian and then arccos the dot product, bus for some reason, it returns NaN half of the time...

Using this:

Return Acos((Sin(Theta1) * Cos(Phi1)) * (Sin(Theta2) * Cos(Phi2)) + (Sin(Theta1) * Sin(Phi1)) * (Sin(Theta2) * Sin(Phi2)) + Cos(Theta1) + Cos(Theta2))
hplus0603
hplus0603
For half spheres, it''s simple. Dot the direction pointing towards the center of the half sphere (normalized) with the direction of the bone (normalized). If it''s less than zero, then the bone has exited the half sphere.
enum Bool { True, False, FileNotFound };

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.