PDA

View Full Version : vizact parallel behavior


njstaley
05-12-2010, 02:00 PM
I'm new to vizard, so please bear with me if I'm missing something obvious.

I have a scene whith two objects (ball and ball2), ball has its center set to a new location using the center function while ball2 does not. After this I want to rotate and move them at the same time with vizact.parallel. When I tried this, ball does not behave as I had expected.

I would expect to see ball orbiting its center location (rotate) while moving(move), and ball2 to be spinning about its center while moving. While ball2 spins as I expected, ball does not orbit like I thought it would. It instead seems to rotate about a different axis and never seems to complete a cycle. Does anyone know why this is happening, or how to work around it?

Thanks in advance for your responses.

ball = viz.add('ball.wrl')
ball.setPosition(0,3,0)
ball.center(1,2,1)

ball2 = viz.add('ball.wrl')
ball2.setPosition(0,1,0)
testAction = vizact.parallel(vizact.move(0,.05,0,20),vizact.spi n(0,1,0,36, 20))

ball.addAction(testAction)
ball2.addAction(testAction)

njstaley
05-14-2010, 11:18 AM
I can apparently get the action that i desire using the vizact.moveTo instead of vizact.move in the parallel action. Unfortunately this does not let me move about local axis by default, forcing me to calculate the desired end position along the local axis before starting the action. Is there a batter and more efficient way to do this?

Thanks

farshizzo
05-14-2010, 11:55 AM
This is a bug with the center command. Instead, trying creating a hierarchical transform to rotate an object about an arbitrary point. You can do this by creating a group node and adding the ball as a child to it. Set the position of the child to whatever rotational offset you desire, then apply the move/spin actions to the group node.