WorldViz User Forum  

Go Back   WorldViz User Forum > Vizard

 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 08-24-2011, 03:45 PM
Sakiot Sakiot is offline
Member
 
Join Date: Aug 2011
Posts: 2
A door question... left button mouse

Hello people, I am new in this program and the teacher gave us some homework... itīs kinda embarrasing because it may be something noob but I tried what my logic gave me in other programs... Here we go

The problem is that I have a door and I need to open it with the left button of the mouse; and then when the door is open use again the left button of the mouse to close it...

I already get how to open the door but I have problems with the closing...

This is my code for the action of opening and closing the door and also the code for the left button of the mouse (Sorry, its in spanish XD)


def clickIzquierdo(): #This def is to assign the action of the Left Button
objeto = viz.pick()
if objeto == puerta:
abrePuerta()

vizact.onmousedown(viz.MOUSEBUTTON_LEFT,clickIzqui erdo)

def abrePuerta(): #This def is to open the door
puerta.runAction(vizact.spinTo(euler = [-90,0,0], speed = 10.0))
sonido_abre.play()

vizact.onkeydown("z",abrePuerta)

def cierraPuerta(): #This def is to close the door
puerta.runAction(vizact.spinTo(euler = [0,0,0], speed = 10.0))
sonido_cierra.play()

vizact.onkeydown("x",cierraPuerta)



By the words of my teacher is that I have to assign the def "cierraPuerta" in the def "clickIzquierdo"... but I dont know how to establish when the door is open and when is closed...The door always open but never closes it
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Mouse bug in V3 and V4 Renato Lima Vizard 2 05-11-2011 06:38 PM
Mouse event: how to detect no mouse move event, how to set mouse position? Zhi Vizard 3 04-11-2011 06:25 PM
Warning mouse() -> Set mouse() of window johannes2 Vizard 1 08-19-2010 02:11 PM
Navigating an avatar using mouse position(2D) in 3D environment james007 Vizard 1 10-16-2009 11:29 AM


All times are GMT -7. The time now is 04:50 PM.


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