Ambiera ForumDiscussions, Help and Support. |
|
[ 1 2 ] Page 1 of 2 |
|
|||||
|
Hey everyone! I have a small question. Is it possible to make a door open if you click it, and then close it if you click it again, without any scripting, and only by using the behavior-options? I have tried for a couple of hours, but I can't get my head around it. thx |
||||
|
I'd say there are multiple ways of doing it. You could do it using an animation, or maybe using a rotation or move behavior. Either way, if you click it once, move it or animate it, and set a variable named for example 'DoorClosed' to 1. And in your action, do the one animation only if the Variable is null, and the other one if the variable is 1. Automatic doors (without clicking) are a bit simpler. You can use a 'On Proximity' behavior for this. |
||||
|
Thx for the reply. I have actually tried for a couple of hours to rotate the door using behaviours and variables, but I'm not able to solve my problem. Think I've just got stuck. I'm able to make the door open and close one time, but thats it. I would like it to be dynamic, so that the door can be opened and closed infinite times. It might be simple, but I can't really figure it out. If its possible, could someone please give me a step-by-step instruction? Would really appreciate it *EDIT* Wow, just got it working! If anyone else is wondering how to do this, just ask and ill try to explain |
||||
|
Yes, please share your knowledge |
||||
|
Allrighty... Here's all the steps: With the door selected, add the behaviour "When clicked on this do something": In Action, add "If a variable has a value, do something": - Give it a variable name, I'll use "Door" - Use "Is equal to" - Value: "null" -- In action, add "Change rotation of a scene node", and rotate the door as much as you want (this is the open door-animation). -- Also add "Set or Change a Variable", -- Variable name: "Door" -- Operation "Add" -- Value "1" Then, go back to the actions for "When clicked on this do something" and add another "If a variable has a value, do something": - Variable name: "Door" - "Is equal to" - Value: "2" -- In action, add "Change rotation of a scene node", and rotate the door back to closed position (if you use absolute rotation, this should be 0,0,0) -- Also add "Set or Change a Variable", -- Variable name: "Door" -- Operation: "Subtract" -- Value: "2" Then, again, add a third "If a variable has a value, do something": - Variable name: "Door" - "Is bigger than" - Value: "0" -- In action, add "Set or Change a Variable" -- Variable name: "Door" -- Operation: "Add" -- Value: "1" And you're done! Kind of repetitive, but it works... If you can't make it work, just ask! *EDIT* For some reason, I can only make this work in Windows Application, not in WebGL and Flash... Does anybody know why? |
||||
|
wrote: For some reason, I can only make this work in Windows Application, not in WebGL and Flash... Does anybody know why? I think this is because you are testing against 'null'. Skip that part and initialize the variable to 1 or 0, so that you always only have it set to 0 or to 1. |
||||
|
wrote: I think this is because you are testing against 'null'. Skip that part and initialize the variable to 1 or 0, so that you always only have it set to 0 or to 1. Tried using a "0" instead of "null" now, but it still doesn't work. Tried to add a door and just a single action to it: "When clicked on this do something" with "Change rotation of a scene node", and that works.. But, shouldn't this work? Doesn't both webGL and Windows Application use java? |
||||
|
No, none of them use Java. Your problem is that the variable in the beginning is uninitialized, it has no value. What happens then is not defined. Simply set the variable to 1 or to 0 in the beginning of your scene by a different action, and it should work then. Maybe adding some action to be able to initialize all used Variables easily to a certain value would be a nice addition for a future version.. |
||||
|
wrote: No, none of them use Java. Your problem is that the variable in the beginning is uninitialized, it has no value. What happens then is not defined. Simply set the variable to 1 or to 0 in the beginning of your scene by a different action, and it should work then. Maybe adding some action to be able to initialize all used Variables easily to a certain value would be a nice addition for a future version.. Ah, okey, will try that! Should have been possible to set variable values on scene start-up, that would definitely be a great feature! |
||||
|
Yea I didn't know how to do that either, what I did was create a fake door on the wall, then added " to next scene" .. Then added a sound of opening and closing the door but build a scene for that room.. I mean yea its tacky I guess but it reminded me of the old resident evil games so I thought it was cool and its easy as well... |
||||
|
my video here explains it: https://www.youtube.com/watch?v=... |
||||
|
so i did when clicked on this do something and then make the door rotate but it never updated the collision. |
||||
|
If using physics need to use updateGeometry() else try add a collide when moved around the door and player...should work.. |
||||
|
the only way i know you could do it is when clicked on do something and then do later and change the scene |
||||
|
joma_ch how bro plus idk if u know how for this but i put my own door in cuppercube and it opens weird like full just turns 90 side ways open but other doors it opens normal. its like normal opens from one side and one it stuck on to wall and this one just turns kind of both it weird idk what to do |
[ 1 2 ] Page 1 of 2 |
|