PDA

View Full Version : Rotate 90 degrees



Henshin1
11-07-2012, 10:23 PM
Hi guys.
I'm playing around in my level now with rotators and rotation sensors. I have a round piece of sticker panel material with an arrow sticker on it. I also have two buttons. What I'm trying to do is. When I press the left button, the arrow rotates exactly 90 degrees left. If I press the right button, it rotates exactly 90 degrees to the right. So if it's pointing up and I press the right button, it will be facing right. But if I press the right button again, it will face down.

Does anyone know a solution to this? It's my first time playing with rotators so I'm not really familiar with these tools :(

Thanks alot everyone :)

ChrisF2112
11-07-2012, 10:57 PM
It's difficult to tell what your logic looks like exactly, but if you are trying to get things to rotate at exactly 90 degree intervals, I would use a couple gyroscopes rather than rotators and angle sensors.

After trying to read very carefully what your problem is, what I understand is that you want to only have three different rotation states (top, left, right), and you don't want it to be upside down at all.

Since it seems like you are using rotators and sensors rather than gyroscopes (I would definitely use gyroscopes, as it would be much easier) I would just disable the input from the right button with an AND gate when the sticker panel is facing right and vice versa for the left side.

Henshin1
11-08-2012, 04:55 AM
Hi ChrisF2112,

Thanks alot for replying! Although I think I should have more clearly stated what I wanted. I do want the arrow to be pointing upside down if rotated enough. Basically I want to be able to rotate the arrow Left 90 degrees, or Right 90 Degrees. It can rotate as many times as the button is pushed but my problem is just getting it to rotate exactly 90 Degrees whenever the Rotate Left or Rotate Right button is pushed.

When I read the description for the Gyroscope it says it's used to prevent the object from rotating as much as possible. Can this tool be used to spin the object around? Is it a bad idea to try to use Rotation Sensors and Rotators to try and accomplish what I am trying to do?

Slaeden-Bob
11-08-2012, 08:40 AM
The Rotation Speed used in LBP2 and LBPV is actually defined as "Degrees of Rotation per Second". So if you have a Rotator and set it to 360, the Rotator will rotate 360 degrees in 1 second. Set the Rotator to 90 and it will only rotate 90 degrees in 1 second.

To make it rotate in 90 degree increments I would therefore connect a Timer to a Rotator. A Timer set to Start Count Down for .1 second wired to a Rotator set to 900 Rotation Speed, will generate a 90 degree rotation in .1 second.

To make you setup account for both left and right rotation is slightly more complicated, but not by much ;)
Making you system not mess up when alternating between left and right in rapid succession is somewhat more complex, but still entirely possible :)


Edit:
I have attached an image showing a possible setup on how to achieve both left and right rotation, without being able to mess it up. I realise that the image quality is not the best, but hopefully it can still be of some use to you...
http://i9.api.vita.lbp.me/img/ft/1e90a577aa9669f543c052996d836658c49fe5aa.jpg
You can find a description in the Spoiler below.
1) The grey wire entering from the upper left is the Up/Down signal from the Left Analogue Stick.
2) The signal is split into a positive and negative component at the yellow Signal Splitter. These two components are used to decide if the arrow rotates left or right.
3a) The positive signal component enters port1 of a Selector in the upper blue circuit. The following Timer(T) is set Start Count Down for .1 second.
3b) The negative signal component enters port1 of a Selector in the lower green circuit. The following Timer(T) is also set Start Count Down for .1 second.
4) This red sub-circuit serves to exclude the positive signal when the negative is active, and vice versa. The OR Gate is Inverted, and the signal is passed onto the Counter, but also the Selector in 5. The Counter(C) is a 1-Step with the Output wired into its own Reset. The Timer(T) used is set to Start Count Down for .2 seconds. The signal from the Counter is finally wired back into port2 of the Selectors in 3a and 3b.
5) The final yellow sub-circuit begins with a 3-port Selector making sure constant signals are generated whenever the Timers in 3 are active. The positive signal goes into port1, the negative signal into port2 and port3 serves as the "off state" when neither positive or negative signals are received. The positive and the negative signal is re-combined in a Signal Combiner before it is finally sent to the Rotator(R). This Rotator is set to Speed Scale with a Rotation Speed of 900, and an Acceleration/Deceleration of 100%.

Note: Make sure the Current State of every Selector is as "high" as possible (i.e. 2 in sections 3a and 3b and 3 in section 5), to avoid jerky movement of the arrow when you unpause.
The above circuit might not be completely optimised, but it will get the job done :p

ChrisF2112
11-08-2012, 01:37 PM
Hi ChrisF2112,

Thanks alot for replying! Although I think I should have more clearly stated what I wanted. I do want the arrow to be pointing upside down if rotated enough. Basically I want to be able to rotate the arrow Left 90 degrees, or Right 90 Degrees. It can rotate as many times as the button is pushed but my problem is just getting it to rotate exactly 90 Degrees whenever the Rotate Left or Rotate Right button is pushed.

When I read the description for the Gyroscope it says it's used to prevent the object from rotating as much as possible. Can this tool be used to spin the object around? Is it a bad idea to try to use Rotation Sensors and Rotators to try and accomplish what I am trying to do?

The gyroscope will turn an object to face in a certain direction, so it is exactly what you want. The best solution to this will be extremely easy. Although what is above would work, it is probably more complex than the solution below (Although I don't have a picture).

Put the signal from your buttons into a signal combiner, then put the signal combiner signal into the selector cycle input. Have 4 gyroscopes attached to the selector outputs (the selector must have 4 different outputs) and rotate each one 90 degrees more than the previous gyroscope was. That will do exactly what you want.

Henshin1
11-08-2012, 06:48 PM
Woah. I've never received such awesome feedback on a problem before.. Thanks so much guys, I've learned alot from both your posts. I'm going to try both of these and see what works best for my situation.
Thanks again so much I appreciate it :D

Slaeden-Bob
11-08-2012, 09:18 PM
Thanks again so much I appreciate it :D

Any time :D

Henshin-a-go-go baby!