|
|
Patrick Elliott wrote:
> Ok, first off, here is what I have to work with:
>
> VecNorm = Normal for the vector.
> VecMag = Magnitude of the vector.
> Rot2Face = VecNorm(0,1,0) * VecMag.
> Rot2Left = VecNorm(1,0,0) * VecMag.
> Wind = returns a value of how "big" a force is blowing in x,y,z.
> GetRot = Current rotation of the object.
> SetForce = Set XForce, YForce and ZForce effecting the object.
>
> Now, what I need to be able to do is take the objects rotation, figure
> out which way its "facing", then negate any movement that pushes it the
> opposite direction. This can be simple when in a fixed orientation,
> facing the same direction as the winds X, or Y. I just check if the wind
> vector is negative, I.e., blowing opposite the +X direction the object
> is facing, and throw out, or reverse the value, so its now blowing +X,
> instead of -X. This is however completely useless if/when trying to make
> it move in an unknown orientation.
Take the dot product of the pushing force vector (not normalized) and
the vector for the facing object (normalized), and check the sign. If
the sign is negative (force and facing opposed to some degree), then
multiply the dot product by the normalized value of the pushing force,
and then subtract this from the pushing force, to yield a vector that is
perpendicular to the pushing force.
Regards,
John
Post a reply to this message
|
|