WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 05-01-2013, 11:22 AM
jacky jacky is offline
Member
 
Join Date: Jun 2011
Posts: 13
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)
Reply With Quote
  #2  
Old 05-02-2013, 10:51 AM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
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)
Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

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


All times are GMT -7. The time now is 05:31 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC