PDA

View Full Version : Rotation


Buster
12-11-2003, 05:22 PM
Hello Vizard Experts,

I am a beginner and need some help. Does anybody know a way (or the code) to allow the user's view to remain stationary (or at least the appearance of it) and to make a constellation of points in space rotate at the same time? We want to create an experiment where students watch a constellation of points while it is rotating so they can understand how all the points relate to each other on a 3-D level but we don't want them to move from their position. Is this possible?

Thanks in advance for your help!

Buster

farshizzo
12-11-2003, 05:53 PM
Hi Buster,

If you attach an object to the HEAD then it will always be centered around the viewer. Let's say that your constellations are in a file called 'constellation.wrl', then you would simply do the following:

stars = viz.add('constellation.wrl',viz.HEAD)

Then when you rotate the model it will be rotating around the head, no matter where the viewer moves.

Are you importing the constellations from a model or generating them on-the-fly? If you're generating them on-the-fly then you would simply do something like the following:

viz.startlayer(viz.POINTS)
viz.vertex(...)
.
.
stars = viz.endlayer(viz.HEAD)

Look at the file spindots.py in the Vizard20/tutorial/onthefly. It is a simple example of creating a sphere of points and rotating them. Good luck!