|
#1
|
|||
|
|||
How to link the Mainview to a child object
Hi everyone,
I want to link the Mainview to the box2. The box2 is the child of box1. When the box1 changes its position and orientation, the box1 will follow it and the Mainview too. But it doesn't work. When I operate the position of box1. The Mainview doesn't move. Who knows the reasons? My script is below. import viz import vizact import math viz.go() dojo = viz.addChild('dojo.osgb') box1=viz.addChild('crate.osgb') box1.setScale(0.1,0.1,0.1) box1.setPosition(0,1.8,1) box1.color(viz.RED) box2=viz.addChild('crate.osgb') box2.setPosition(0,1,0) box2.color(viz.BLUE) box2.setParent(box1) link1=viz.link(box2,viz.MainView) def position(): pos=box1.getPosition() pos[0]=pos[0]+0.01 box1.setPosition(pos) vizact.onkeydown('1',position) |
#2
|
|||
|
|||
You'll need to specify that the link is getting the source object's position in global coordinates. Otherwise the link takes the position of box2 in it's parent's coordinate system which is fixed at [0,1,0].
Code:
link1=viz.link(box2,viz.MainView,srcFlag=viz.ABS_GLOBAL) |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How can I link MainView with HMD and a 3d node? | Salvar | Vizard | 5 | 03-22-2011 09:14 PM |
Link MainView to instable platform | sleiN13 | Vizard | 2 | 01-10-2011 01:33 AM |
Remove link and have object drop/collide? | cgibb | Vizard | 6 | 03-02-2010 05:18 PM |
Can you link the position of a tracker to the orientation of an object? | michaelrepucci | Vizard | 1 | 09-19-2008 11:23 AM |
Child Object Rotation | paulgoldberg | Vizard | 5 | 09-05-2006 12:33 PM |