POV-Ray : Newsgroups : povray.advanced-users : Facing objects : Re: Facing objects Server Time
29 Jul 2024 10:20:37 EDT (-0400)
  Re: Facing objects  
From: hughes b
Date: 30 Jul 2002 03:44:45
Message: <3d4643ed@news.povray.org>
"Rohan Bernett" <rox### [at] yahoocom> wrote in message
news:web.3d46268eeedc796bd02c7b870@news.povray.org...
> A couple of questions relating to rotation:
>
> How do I make an object always face the camera, like the sprites do in
> Duke3D?
>
> How do I make an object moving along a spline turn to match the spline? I
> know it's easy to do with the camera, just set look_at to clock+0.1, but
> how do I do it with any object?

Take a look at scenes\incdemo\screen.pov and its associated screen.inc. The
Camera_Transform in that creates a face-the-camera effect.

You might even adapt that to a spline as well, not sure though.
I think you could actually get the path-pointing thing done by duplicating
the path spline and altering the timing intervals so that the pointing
direction is just a copy of the path with a slight advance in timing.
You won't get the proper effect if you simply add 0.1 to the vector because
of positives and negatives. Once the camera or object faces toward -z
instead of +z, for example, it still wants to look toward +z. No good.
So, let's say, getting the front of a rocket to point toward where it's
going when using a pair of splines you'll need to use one vector as the
overall motion and the pointing vector as a direction. The motion vector is
the baseline, the pointing vector must either be used as a anchor for the
tip of the rocket (end of a cylinder, etc.) or some calculation needs to be
done between the two vectors.

I think one of the math.inc macros could help with the second way but I
don't have any ideas about that, sorry.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.