WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #5  
Old 04-12-2009, 10:03 AM
5ky1ine 5ky1ine is offline
Member
 
Join Date: Mar 2009
Posts: 10
Unhappy

i've added the code but my doors seem to be opening in a strange direction, when i click on them they rotate and end up somewhere else, i've added my code below for you 2 have a look at.

one more thing i have exported baked textures from 3ds max and one of them comes with grey patches for some reason, the rest work fine.


import viz

viz.go()

viz.clearcolor (0.5,0.5,1)

myHUD = viz.addTexQuad(viz.SCREEN)
myImage = viz.add('myHud.png')
myHUD.setPosition(0.5,0.5,0)
myHUD.setScale(0.2,0.2,0)
myHUD.texture(myImage)

door1 = viz.add('door1.ive')
door2 = viz.add('door2.ive')

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

#Door1

#change the origin and where door will rotate
door1.center(1,1,0.1)

#create a spinning action for the door
opendoor = vizact.spinto(0,6,0,90,90)

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

#Door2

#change the origin and where door will rotate
door2.center(1,1,0.1)

#create a spinning action for the door
opendoor = vizact.spinto(0,6,0,-90,90)

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


MOVE_SPEED = 5
TURN_SPEED = 60

view = viz.get(viz.MAIN_VIEWPOINT)


def mytimer (num):
if viz.iskeydown(viz.KEY_UP):
view.move(0,0,MOVE_SPEED*viz.elapsed(),viz.BODY_OR I)
elif viz.iskeydown(viz.KEY_DOWN):
view.move(0,0,-MOVE_SPEED*viz.elapsed(),viz.BODY_ORI)
elif viz.iskeydown(viz.KEY_RIGHT):
view.rotate(0,1,0,TURN_SPEED*viz.elapsed(),viz.BOD Y_ORI,viz.REL_PARENT)
elif viz.iskeydown(viz.KEY_LEFT):
view.rotate(0,1,0,-TURN_SPEED*viz.elapsed(),viz.BODY_ORI,viz.REL_PARE NT)

viz.callback(viz.TIMER_EVENT,mytimer)
viz.starttimer(0,0.01,viz.FOREVER)

def mousemove(e):
euler = view.getEuler(viz.HEAD_ORI)
euler[0] += e.dx*0.1
euler[1] += -e.dy*0.1
euler[1] = viz.clamp(euler[1],-95.0,85.0)
view.rotate(euler,viz.HEAD_ORI)

viz.callback(viz.MOUSE_MOVE_EVENT,mousemove)

viz.mouse(viz.OFF)
viz.cursor(viz.OFF)
viz.restrictmouse(viz.ON)
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 11:17 PM.


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