WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #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
 


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


All times are GMT -7. The time now is 12:08 AM.


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