PDA

View Full Version : Steering wheel mini


Biom
05-29-2013, 06:10 AM
In a previous post I read about the possibilty to control the wheels of the mini.osg
Is it possible to control the steering wheel as well
I've tryed this, but the steering wheel turns around some orientation of the car.
How can change this?


ground = viz.add('tut_ground.wrl')
car = viz.add('mini.osg', pos = [0,0,7], euler = [90,0,0])

# Get raw handle to 'rfr' group node
steering = osg.getRootNode(car).findChildren('steeringwheel')[0]

# Get handle to children
children = steering.getChildren()

# Create new raw group node to hold children
steerGroup = osg.addGroup('SteeringWheel')
steerGroup.setChildren(children)

# Insert tire group underneath rfr node
steering.setChildren([steerGroup])

# Get handle to new group node
wheel = car.getChild('SteeringWheel')
spin = vizact.spin(0,1,0,90)
wheel.addAction(spin)



Any help is welcome

Jose
06-17-2013, 09:00 AM
Could you explain better, The Steering wheel turns the orientation of the car body?

Biom
06-17-2013, 11:53 PM
The steering wheel turns around the origin of the car.
Instead of turning around its own axis, it turns around the aixs of the car.
But if you look at the following script, the wheels turn around there own axis.
I would like the same kind of rotation but then for the steering wheel of the mini.


import viz

osg = viz.add('SceneGraphTools.dle')

ground = viz.add('tut_ground.wrl')
car = viz.add('mini.osg', pos = [0,0,7], euler = [90,0,0])

# Get raw handle to 'rfr' group node
rfr = osg.getRootNode(car).findChildren('rfr')[0]

# Get handle to children
children = rfr.getChildren()

# Create new raw group node to hold children
tireGroup = osg.addGroup('RightFrontTire')
tireGroup.setChildren(children)

# Insert tire group underneath rfr node
rfr.setChildren([tireGroup])

# Get handle to new group node
tire = car.getChild('RightFrontTire')
spin = vizact.spin(1,0,0,90)
tire.addAction(spin)

viz.go()