Portal 2

Portal 2

Community maps. For science.
Welcome to Aperture Laboratories, home of the Perpetual Testing Initiative. Easily create, share and play test chambers authored by and for the Portal 2 community. Do your part! Contribute to Science!
KyloX 8 Jun 7, 2014 @ 4:39am
[Hammer] Rotating object in need of help
Hey yo,
Alright, this is what I got: an object and 2 buttons.

What I want:
When pressed button 1, it turns 90 degrees left. After 2-3 seconds, you can press the button again and it turns left once more. This can continue on and on.

When pressed button 2, it turns 90 degrees right. Same features as button 1 just in the other direction.

What I tried:
door_rotating - works almost good, but has a fixed distance, meaning that only once you can turn into wanted direction

func_rotating - would be best, but doesn't have distance.

Help me out here.
Thanks in advance
< >
Showing 1-4 of 4 comments
TeamSpen210 17 Jun 7, 2014 @ 1:33pm 
The speed parameters for func_rotatings are in degrees per second (func_doors/movelinears are hammer units per second). If you set the speed to 90, it will take exactly 1 second to rotate 90 degrees. What you want to do is have outputs to start it rotating and then stop it 1 second later. Use the Lock and Unlock inputs to prevent pressing buttons while it's moving and messing up the system.

Alternatively, you could have two func_door_rotatings, one for each direction. To rotate parent the object to the door, Open it, then ClearParent and Close the door to reset it. The various OnOpen, OnClose, OnFullyOpen, OnFullyClosed outputs will be helpful in setting outputs. OnButtonPressed Lock both buttons, set the parent, set the speed of the door to whatever you want, then open the door 0.01s later (to make sure the inputs fire). OnFullyOpen clear the parent, set the speed to something like 100000 (so it resets very fast), then close the door 0.01s later. OnFullyClosed Unlock the buttons.
Andrey Jun 7, 2014 @ 1:40pm 
the speed is good
KyloX 8 Jun 7, 2014 @ 1:47pm 
Oh cool, didn't knew about that degree thingy, probably gona try that first.

The door_rotating is more complicated in this situation. I was half way thinking out on how to do this, but just got frustrated and ended in posting this.

Thanks, this will indeed help me out and won't stress me out.
TeamSpen210 17 Jun 7, 2014 @ 7:34pm 
Something else to know: if you are using timed outputs like this that can be triggered by the player, it can be a good idea to take advantage of the CancelPending output on logic_relays. This stops outputs from firing if they have been triggered, but not run because of a set delay. It's not as useful here as you are able to lock the buttons to prevent players messing with it but in other situations (like with floor buttons, players are able to press and release them very quickly) it is very helpful.

You can use a math_counter and logic_case to keep track of the position of the object, and fire outputs based on the position. (Post if you want me to explain.) If you want an example for the door rotating version, see ChickenMobile's portalgun stand (only one way but it's pretty similar the opposite direction, you want the one a few posts down that rotates): http://forums.thinkingwithportals.com/post63857.html?#p63857
< >
Showing 1-4 of 4 comments
Per page: 15 30 50

Date Posted: Jun 7, 2014 @ 4:39am
Posts: 4