![]() |
Using hotspots to enable opening doors
Hello, I have a question about hotspots. How is it possible to use a hotspot to enable someone to open a door?
What I'm looking for is for the player to walk up to a door, being right next to the door will enable him/her to actually use the command to open the door. My code is as follows: Code:
Thanks in advance :) |
Also, just curious, is there a way to view the hotspots so as to make it easier to move them around?
|
you could set a variable that is true when one is inside or false when outside of the hotspot. Then if the door key is pressed and the value is true you open the door.
here is a link to some code that keeps track of whether you have entered or left a hotspot. it also draws a circle where one of the hotspots is. Look at the code at the end of the post http://www.worldviz.com/forum/showth...hlight=hotspot then you could add something like Code:
def onKeyDown(key): |
Hi thank you for your response, I've tried what you said but it doesn't work still. Here is what I tried:
Code:
import viz What do you think I should do for that? |
There are two problems with your code. First your mykeyboard function should not be inside of you handlemyhotspots function. You also need a viz.callback line. Try the following code.
Once you enter the safe zone the variable openDoor will be set to true. When you leave the safe zone openDoor is set to false. When you press a key the onKeyDown function will be called. If openDoor is true and the keypressed is 'e' you will be able to open the door. Code:
import viz |
It worked like a charm, thanks!
...Do you know of a way that one can bind an avatar to the viewpoint, and use the door in a way where, the user presses 'e' and sees the avatar's hand opening the door? If not, that's okay, this will do perfectly. |
You can link the viewpoint to the avatar and manipulate the arm bone so it moves to the doorknob. Here's an example using a link with an offset so the viewpoint is behind the avatar. When the avatar stops moving he raises his arm.
Code:
import viz |
Hmm... I'm having some difficulty combining this into an environment where there's a door to open. Here is my code so far:
Code:
import viz Thanks again for sticking around and helping me a bit through this. |
All times are GMT -7. The time now is 01:03 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC