Alice Community

Alice Community (http://www.alice.org/community/index.php)
-   How do I...? (http://www.alice.org/community/forumdisplay.php?f=16)
-   -   Open gate when camera is near (http://www.alice.org/community/showthread.php?t=10171)

dkchandler 07-16-2013 01:24 PM

Open gate when camera is near
 
I know this is probably super simple, but I can not get it to work. I just want to let the user move around in the world with the mouse and when they get close to the haunted gate it opens. I am using the 'gate distance to camera' and it is not triggering the gate to open???? Any suggestions? Thanks

Dan

Alice 2.3

dkchandler 07-16-2013 02:07 PM

I figured it out.... I needed to use an IF statement and wrap that in a WHILE loop.

Dan

chickentree 07-17-2013 11:20 AM

[QUOTE=dkchandler;53226]I figured it out.... I needed to use an IF statement and wrap that in a WHILE loop.

Dan[/QUOTE]

You could also use an event. This would be more efficient than doing it in a method and Alice keeps track of continuously checking the event.

Mark

AliceMaster00 07-30-2013 06:38 PM

if camera is within <threshold> of <gate-name>
do
{
<whatever>
}
else
{
nothing
}


sorry if this is confusing, im used to scripting in C# and Java, so i tried my best to match the visual scripting.

Basically, just grab the function stated above (within threshold of),
then put in whatever you'd like the gate to do. If you're making it open, i suggest creating a dummy facing the direction you would like the gate doors to face when open. Then move the dummies(one for each door) about a meter or 2 forward(make sure axis zed"blue axis" is facing the angle the doors are going to swing open to). After thats done in the do section of the if statement put this

if camera is within <threshold> of <gate-name>
do
{
do together
{
<gate-door-1> face (orient to) <dummy1>
<gate-door-2> face (orient to) <dummy2>
}
}


placing a "turn" function would make the doors turn every time you got near them, and you'll end up with the gates doing 360's through walls (if you had)
or if you used a "while" function as well.


All times are GMT -5. The time now is 05:46 AM.

Copyright ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.