View Single Post
  #4  
Old 04-10-2009, 02:01 PM
Jeff Jeff is offline
WorldViz Team Member
 
Join Date: Aug 2008
Posts: 2,471
Here is a box scaled to have the shape of a door. There is a spinning action that is added to the door when you click on it.
Another way of doing this would be to use the physics engine and add a hinge joint to the door. When you click on the door a force is applied making it swing open

Code:
import viz
viz.go()

import vizinfo
info = vizinfo.add("Click on the door") 

viz.add('tut_ground.wrl')

door = viz.add('box.wrl', pos = [0,1,8], scale = [1,2,.05])

#change the origin and where door will rotate
door.center(-.5,0,0) 
 
#show the rotation point
ball = viz.add('ball.wrl', pos = [-.5,1,8], scale = [.2,.2,.2])

#create a spinning action for the door
opendoor = vizact.spinto(0,1,0, 120, 30.0)

#add the action to the door when clicked on
vizact.onpick(door, door.addAction, opendoor)

#put someone behind the door
female = viz.add('vcc_female.cfg', pos = [0,0,10], euler = [180,0,0])
female.state(5)

#disable mouse navigation
viz.mouse(viz.OFF)
Reply With Quote