WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Link only one Axis (https://forum.worldviz.com/showthread.php?t=4618)

Andy 06-05-2013 09:33 AM

Link only one Axis
 
Hello,
I want to link the orientation of an mySensor with a node (box).
In my example I link the node with the MainView. Furthermore, I want to link the orientation of my sensor (src) with the node (dst) too. But not all axis, like in my example, I want to link only the orientation of the Y-axis of mySensor.
Is this possible?

Code:

import viz
viz.go()

box = viz.add('box.wrl', pos=[0,0,0])
plan = viz.add('tut_ground.wrl')

mySensor = viz.add( 'testtrack_all.dls' )

link = viz.link(viz.MainView, box, mask=viz.LINK_POS|viz.LINK_ORI)
link.postTrans([0,0,6])
viewLinkOp = link.preMultLinkable(mySensor, target=viz.LINK_ORI)


Kevin Chiu 06-06-2013 12:52 PM

Hi Andy,

Is this the effect which you want?

Code:

import viz
viz.go()

box = viz.add('box.wrl', pos=[0,0,0])
plan = viz.add('tut_ground.wrl')

mySensor = viz.add( 'testtrack_all.dls' )

link = viz.link(mySensor, box, mask=viz.LINK_ORI)
link.preScale([1,0,0], target = viz.LINK_ORI_OP)
viewLink = viz.link(link, viz.MainView)


Andy 06-07-2013 12:38 AM

In part, now affected mySensor also on the MainView, that shouldnt‘ be. The orientation of mySensor (y-axis) should additional affected only on the linked box.
Any idea?

Kevin Chiu 06-07-2013 02:09 PM

You can just comment out the last line of the script.

Andy 06-10-2013 01:18 AM

Yes I know but I want to link the MainView to the box node. The y orientation link of mySensor should be added like the ‘preMultLinkable’ function realize this.

Andy 06-13-2013 01:01 AM

Is there no solution for my problem?
- Filter a pre-multiply linkable operator so that only one axis of the pre-multiply-node takes an effect on the main link, like "target = viz.LINK_ORI_Y"

Jeff 06-13-2013 11:33 AM

You want the position/pitch/roll of the box based on the viewpoint and the yaw of the box based on the sensor, correct?

If that's the case you could manually update the box orientation every frame in a function registered with vizact.onupdate:
Code:

import viz
import vizact
viz.go()

box = viz.add('box.wrl', pos=[0,0,0])
plan = viz.add('tut_ground.wrl')

mySensor = viz.add( 'testtrack_all.dls' )

link = viz.link(viz.MainView, box, mask=viz.LINK_POS)
link.postTrans([0,0,6])

def updateOri():
        yaw = mySensor.getEuler()[0]
        pitch = viz.MainView.getEuler()[1]
        roll = viz.MainView.getEuler()[2]
        box.setEuler([yaw,pitch,roll])
       
vizact.onupdate(0,updateOri)


Andy 06-18-2013 02:30 AM

Thanks :) it works


All times are GMT -7. The time now is 03:17 PM.

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