|
![](/i/fill.gif) |
"Greg M. Johnson" wrote:
>
> The rub comes in determining the angle. I have vectors that can be pointing in
> any which way. I am not making a merry go round, but having particles
> (spacecraft, birds) interact with hundreds of other particles via forces which
> are in 3d. I want the "orientation" to be correct but with minimum or no
> "roll".
>
> A fish or bird in a swarming school might "point" its nose in any direction, but
> I'm sure that it maximizes the amount of time its feet are below its body:
> minimum roll. The plain ol' reorient macro gives a roll as one reorients around
> a circle. My hunch is that I could just change a sign or two in one of the
> matrices and be all right.
>
> Nieminen Juha wrote:
>
Provided you stay in a x-z plane, and provided velocity is normalized,
you can replace your call to reorient by:
matrix <velocity.x, 0, -velocity.y,
0, 1, 0,
velocity.y, 0, velocity.x,
0, 0, 0>
If you don't stay in the x-z plane, there is no real way to do it, you
can still try this if you don't go on too steep slopes:
#local u = vnormalize (<v.x, 0, v.z>);
matrix <v.x, v.y*u.z-v.z*u.y, u.x,
v.y, v.z*u.x-v.x*u.z, u.y,
v.z, v.x*u.y-v.y*u.x, u.z,
0, 0, 0>
(There might be a sign problem in the middle column wich would cause a
"mirror effect", and i might have mixed lines and columns wich would
cause very strange behavior...)
Jerome
--
*******************************
* they'll tell you what can't * mailto:ber### [at] iname com
* be done and why... * http://www.enst.fr/~jberger
* Then do it. *
*******************************
Post a reply to this message
|
![](/i/fill.gif) |