[Solved] Rotating the panel 90 degrees

Avatar
dhavalmistry
107 Posts
Posted Jul 07, 2011
Hello all,

I was wondering how I would rotate a panel 90 degrees every 10 second or so, much like in this video.

http://www.youtube.com/watch?v=oyAVJ3we ... 8index=19

The energy ball spawner is rotating 90 degrees on Y axis every 10 seconds or so.

Thanks in advance!

&&&&

Advertisement
Registered users don’t see ads! Register now!
Avatar
ChickenMobile
2,460 Posts
Posted Jul 07, 2011
Replied 24 minutes later
logic_timer
func_door with more func_door's
Avatar
MissStabby
160 Posts
Posted Jul 07, 2011
Replied 14 minutes later
wouldnt it be more practical to add a single func_rotating with a set speed (90 degrees a second) and having the start&stop being set at exact 1 second intervals by a timer?
Avatar
ChickenMobile
2,460 Posts
Posted Jul 07, 2011
Replied 1 hour later

MissStabby wrote:
wouldnt it be more practical to add a single func_rotating with a set speed (90 degrees a second) and having the start&stop being set at exact 1 second intervals by a timer?

The problem with this is that even though it might seem it will rotate exactly, if it turns enough times (or your computer lags) the func_rotating will eventually go out of line. Hence the need for a door or a func_rot_button.

Avatar
dhavalmistry
107 Posts
Posted Jul 07, 2011
Replied 25 minutes later

chickenmobile wrote:
The problem with this is that even though it might seem it will rotate exactly, if it turns enough times (or your computer lags) the func_rotating will eventually go out of line. Hence the need for a door or a func_rot_button.

thats exactly the problem I am having. I have a panel that rotates 90 degrees when button is pressed. If I press it enough times, it goes out of sync.

How can it be fixed?

Avatar
Kasc
77 Posts
Posted Jul 07, 2011
Replied 8 hours later

I made an amazing image just for you:

http://i.imgur.com/MDjX5.jpg

P.S. It spins on the z axis.

imgz

z axis is up in hammer.

Avatar
Rand0mNumbers
76 Posts
Posted Jul 07, 2011
Replied 59 minutes later
Try a momentary_rot_button and send it SetPosition inputs. That's what is used in here: http://www.youtube.com/watch?v=-Epr3khsZUg

It won't go out of alignment, but I don't know how you'd keep it rotating continuously. The button doesn't wrap around to rotate from 270 to 0, it rewinds. Perhaps momentarily toggling the startdirection keyvalue would help.

Avatar
dhavalmistry
107 Posts
Posted Jul 07, 2011
Replied 1 hour later

Kasc wrote:
I made an amazing image just for you:

P.S. It spins on the z axis.

z axis is up in hammer.

Yes Z is up in hammer. I have a 3d background where Y is up. Anyways, thanks for the image but what I am trying to do is completely different. I have a panel that is standing up (like a wall) and I need it to turn 90 degrees on Z axis when the button is pressed so the player can make a portal on it from each corner of the room and I need it to rotate 90 degrees exactly so that the players can press the button as many times as they wants and not go out of sync.

Avatar
ChickenMobile
2,460 Posts
Posted Jul 08, 2011
Replied 8 hours later

dhavalmistry wrote:
Anyways, thanks for the image but what I am trying to do is completely different. I have a panel that is standing up (like a wall) and I need it to turn 90 degrees on Z axis when the button is pressed so the player can make a portal on it from each corner of the room and I need it to rotate 90 degrees exactly so that the players can press the button as many times as they wants and not go out of sync.

So is there more than 2 possible directions for the panel to turn?
If there is just two you could be crafty and use a panel with the right animation. Then use either a logic_branch or a math_counter with a logic_case to set the correct animation.
This will also make it look more Portal 2 style.

Avatar
dhavalmistry
107 Posts
Posted Jul 08, 2011
Replied 1 hour later

chickenmobile wrote:
So is there more than 2 possible directions for the panel to turn?
If there is just two you could be crafty and use a panel with the right animation. Then use either a logic_branch or a math_counter with a logic_case to set the correct animation.
This will also make it look more Portal 2 style.

No, I only want the panel to turn in one direction.

Avatar
ChickenMobile
2,460 Posts
Posted Jul 08, 2011
Replied 18 minutes later

dhavalmistry wrote:
No, I only want the panel to turn in one direction.

Four directions then?

Avatar
dhavalmistry
107 Posts
Posted Jul 08, 2011
Replied 12 minutes later

chickenmobile wrote:
Four directions then?

Press the button --> Panel turns 90 degrees counter clockwise

Press the button again --> Panel turns another 90 degrees counter clockwise (180 degrees from starting position)

Press the button third time --> Panel turns (180+90) 270 degrees

Press the button 4th time --> Panel turns (270+90) 360 degrees a.k.a. starting position.

and it keeps doing that as long as the player wants.

Avatar
dhavalmistry
107 Posts
Posted Jul 08, 2011
Replied 6 minutes later

Rand0mNumbers wrote:
Try a momentary_rot_button and send it SetPosition inputs. That's what is used in here: http://www.youtube.com/watch?v=-Epr3khsZUg

It won't go out of alignment, but I don't know how you'd keep it rotating continuously. The button doesn't wrap around to rotate from 270 to 0, it rewinds. Perhaps momentarily toggling the startdirection keyvalue would help.

Hey, I tried doing like you suggested but its not working. Maybe I am doing something wrong. Is there a vmf I can look at or can you make me one with a room and one panel rotating on press of a button please?

Thanks in advance!

Avatar
Kasc
77 Posts
Posted Jul 08, 2011
Replied 1 hour later
Just an edit of my image is what you want, but the button tells the door to open and not the OnFullyClosed output.

Targetnames:
panel - the thing you want to rotate
doorparent - the thing panel gets parented to that's got a distance of 90 and set to rotate along the same axis as the panel
button: Button to rotate the panel.

Output, Targetname, Input, Parameter, Delay

button:

OnPressed, !self, Lock, , 0
OnPressed, panel, SetParent, doorparent, 0
OnPressed, doorparent, Open, , 0.01

doorparent:

OnFullyOpen, panel, ClearParent, , 0
OnFullyOpen, !self, Close, , 0.01
OnFullyClosed, button, UnLock, , 0

Avatar
dhavalmistry
107 Posts
Posted Jul 08, 2011
Replied 25 minutes later

Kasc wrote:
Just an edit of my image is what you want, but the button tells the door to open and not the OnFullyClosed output.

Targetnames:
panel - the thing you want to rotate
doorparent - the thing panel gets parented to that's got a distance of 90 and set to rotate along the same axis as the panel
button: Button to rotate the panel.

Output, Targetname, Input, Parameter, Delay

button:

OnPressed, !self, Lock, , 0
OnPressed, panel, SetParent, doorparent, 0
OnPressed, doorparent, Open, , 0.01

doorparent:

OnFullyOpen, panel, ClearParent, , 0
OnFullyOpen, !self, Close, , 0.01
OnFullyClosed, button, UnLock, , 0

I am at work right now so I cant test but just by reading it, it makes sense!

Avatar
dhavalmistry
107 Posts
Posted Jul 08, 2011
Replied 9 hours later

Kasc wrote:
Just an edit of my image is what you want, but the button tells the door to open and not the OnFullyClosed output.

Targetnames:
panel - the thing you want to rotate
doorparent - the thing panel gets parented to that's got a distance of 90 and set to rotate along the same axis as the panel
button: Button to rotate the panel.

Output, Targetname, Input, Parameter, Delay

button:

OnPressed, !self, Lock, , 0
OnPressed, panel, SetParent, doorparent, 0
OnPressed, doorparent, Open, , 0.01

doorparent:

OnFullyOpen, panel, ClearParent, , 0
OnFullyOpen, !self, Close, , 0.01
OnFullyClosed, button, UnLock, , 0

You my friend are a GENIUS!! :biggrin:

It works!!

Avatar
Kasc
77 Posts
Posted Jul 08, 2011
Replied 3 hours later
No problemo!
Avatar
Rand0mNumbers
76 Posts
Posted Jul 09, 2011
Replied 7 hours later

dhavalmistry wrote:

Hey, I tried doing like you suggested but its not working. Maybe I am doing something wrong. Is there a vmf I can look at or can you make me one with a room and one panel rotating on press of a button please?

Thanks in advance!

From your last post, you have it working, but I've attached the vmf anyways.
I don't know how to stop the panel from wrapping around. Math_counter handles integers, but not doubles, so I don't know what to do right now.

Pressing the button will place the panel in 4 different positions sequentially. Once you reach the end, it will rewind itself and start again.

Attachments
momentary_rot_example.vmf
0.02 MB 33 downloads
Advertisement
Registered users don’t see ads! Register now!
Avatar
dhavalmistry
107 Posts
Posted Jul 09, 2011
Replied 1 hour later

Rand0mNumbers wrote:
From your last post, you have it working, but I've attached the vmf anyways.

Yes I have it working and thanks for the vmf. I am sure I will learn a thing or two from your map!