PDA

View Full Version : Viztask overview?


simrus
11-14-2016, 11:18 AM
I'm coming to Vizard from having previously written all my own code in Opengl in C with for loops and things, and its proving a bit of a culture shock....

I want to do something that should be very simple but I'm struggling. I want to make the movement of an object(/s) in the scene contingent of the movement of the viewpoint. To give an example, imagine an object that copies the movement of the viewpoint (i.e. the viewer). So previously what I'd do is calculate the movement of the viewpoint (current_position-old_position) and then apply the same movement vector to the object. I'd maybe add a bit of noise or a temporal delay (so I'd need to buffer movements in an array) so it doesn't follow perfectly.

I think I need to use viztask for this purpose but I can't work out how to use it. The documentation seems to jump from simple tutorials/demos that use canned actions to in-depth info that goes over my head. Is there any further documentation that gives me an overview of how viztask works and the ideas behind it?

simon

Jeff
11-15-2016, 05:39 PM
One option might be to set the object's reference frame (http://docs.worldviz.com/vizard/#commands/node3d/setReferenceFrame.htm) so transformations are relative to the view.

Use the vizact.onupdate (http://docs.worldviz.com/vizard/#commands/vizact/onupdate.htm) command to register a function that gets called every frame. In that function you could get the view position and based on that set a new position for the object.