PDA

View Full Version : Fix the positon of objects on a scene


AlyssaK
01-03-2007, 08:10 PM
Hi everyone,

I have inserted the text "X" within a cube (the cube is similar to one of the tutorials). I'm interested in fixing the location of this within the cube. I would also like to allow the user to navigate throughout the scene without affecting the fixed positions.

Can you point me in the right direction?

I've tried this:

hole1 = cube.add(viz.TEXT3D, "X")
hole1.setScale(0.3,0.3,0.3)
hole1.setPosition(0.4,1.0,4)

It still affects the location when zooming in etc.

Thanks.

P.S. sorry couldn't think of a better topic description for this question...

Gladsomebeast
01-04-2007, 01:18 PM
It seems like your code does what you want to do. Try my code and let me know if this is what you want.

import viz
viz.go()

cube = viz.add('box.wrl')
hole1 = cube.add(viz.TEXT3D, "X")
hole1.setScale(0.3,0.3,0.3)
hole1.setPosition(0.4,1.0,4)

AlyssaK
01-07-2007, 10:52 PM
Thanks for your post.

My initial intention was to fix the position of the point's (X's) on the cube and to maintain this scale when zooming in and out.

I realised that a simple solution (for this stage) was to disable mouse navigation.

If you happen to come across a solution for this please post a response.

Thanks

Gladsomebeast
01-08-2007, 09:13 AM
I see...

The solution here is to use the worldToScreen fuction and add the text to the screen. Update the position of the text on the screen every frame with the worldToScreen fucntion.