need newbie math help
Posted: Wed May 04, 2011 6:27 pm
okay so i have a system, call it system SlideFactor
SlideFactor has two inputs, both are 3d vectors. one of those is a normalized vector, call it Normal. call the other vector force. vector force may or may not come in normalized.
SlideFactor outputs a single 3d vector, vector Output, it is always normalized before being outputed.
Now, here is what I need to do:
vector Output must satisfy these reqs.
1. Be _a_ vector perpendicular to vector Normal. <-- infinite number of solutions
then
2. Be coplanar to vectors Normal and Force <-- two solutions at this point
3. Be inside the smaller angle formed by Normal and Force. <-- one solution at this point.
If the angle between Normal and Force is less than or equal to 90 degrees it returns vector Force
If the angle is equal to 180 degrees it returns vector Output = (0.0,0.0,0.0)
I'm just barely starting to write the code for this... will probably have it and several other features for my game that were waiting on this ready by the end of the day... but just making math discussion, and incase anyone else needed something like this. you can use it to vector forces and velocities along a surface of an object for correct sliding.
UPDATE: okay i will just take vector Normal, and rotate within the plane created by vector Normal and Vector Force by plus/minus 90 degrees, depending on the handed system.
SlideFactor has two inputs, both are 3d vectors. one of those is a normalized vector, call it Normal. call the other vector force. vector force may or may not come in normalized.
SlideFactor outputs a single 3d vector, vector Output, it is always normalized before being outputed.
Now, here is what I need to do:
vector Output must satisfy these reqs.
1. Be _a_ vector perpendicular to vector Normal. <-- infinite number of solutions
then
2. Be coplanar to vectors Normal and Force <-- two solutions at this point
3. Be inside the smaller angle formed by Normal and Force. <-- one solution at this point.
If the angle between Normal and Force is less than or equal to 90 degrees it returns vector Force
If the angle is equal to 180 degrees it returns vector Output = (0.0,0.0,0.0)
I'm just barely starting to write the code for this... will probably have it and several other features for my game that were waiting on this ready by the end of the day... but just making math discussion, and incase anyone else needed something like this. you can use it to vector forces and velocities along a surface of an object for correct sliding.
UPDATE: okay i will just take vector Normal, and rotate within the plane created by vector Normal and Vector Force by plus/minus 90 degrees, depending on the handed system.