On Sun, 4 Mar 2001, Arvind Lakshmikumar wrote:
> Hello,
> I had posted a query y'sday about updating object states in inventor. I
> saw the calculator example. I need to do something similar to that(plan a
> path). Only difference is that my path has already been computed and I
> have 3 floats that give me the objects coordinates.
> I have an initial position (x,y,0) and a set of positions(floats). I tried
> to use the Calculator engine but couldn't get it to work. Since I don't
> have a time or any other counter, what do I give to
> calcXZ->A.connectFrom(...)
It would be more efficient if you used a callback to update states on
a regular basis instead of using the caculator. The calculator is useful
if you need to define some simple procedular behavior. For anything
more complex, I would write my own engine, or just use a callback. In
your specific situation, the callback seems like the best way to go.
You can define a callback with SoOneShotSensor. Assign some high
priority to the sensor, say 1, and your callback will be pretty much the
first thing that Inventor's event manager will call every time it needs
to update the scene. Inside the callback of SoOneShotSensor, do your
operation (such as updating the position of an object), and then
reschedule the same sensor again. This will let you reuse the same
sensor over and over and your callback will get constantly called.
If you need some complex event management, you may want to consider
writing your own event manager to replace Inventor's.
Jonatham suggested that you use SoAlarmSensor but if you use that sensor,
you are tied to processing your events every so many timer units. If you
use SoOneShotSensor, you will be processing them as fast as you possibly
can.
KV
--
___________________________________________________________________
Studio Tools vkire@xxxxxxxxx
Pixar Animation Studios http://www.pixar.com/
|