Measure rotation in unlimited degrees
ProjectorX
Member Posts: 45
I've been working with gamesalad before where the rotation attribute returns degrees without going back to 0 after 359. For instance, two clockwise revolutions would return 720. Two counter-clockwise revolutions would return -720.
I need to be able to do it this way again.
Right now it's returning it in degrees like an angle variable even though I'm storing it as real.
I need to be able to do it this way again.
Right now it's returning it in degrees like an angle variable even though I'm storing it as real.
Answers
Is that correct?
Cheers, M@
Now, though, while I have you here, the new problem is that rotate to angle only rotates counter-clockwise.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I think the problem here (in working out the issue) is that there is so little information supplied, nothing is put in any context, all we can do is make guesses as we can't see the code that is causing this issue.
So rotate to angle 179 from 0 is anticlockwise.
Rotate to angle 181 from 0 is clockwise.
Without a detailed explanation with sample code or the sample project it's difficult to give a good solution on here sorry.
Cheers, M@
Example V2:
Cheers, M@
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
https://www.dropbox.com/s/ebdnczi00ryix6p/Rotate to Angle.gameproj.zip
You can find the behaviors in question in the white "car" actor in the top group called "Issue". And there are a couple different solutions to achieve the desired effect, but they all have the same problem: they want to take the long way around.
There are two actors so that one can rotate to the angle of the other. The other's angle is dynamic and can change. The white car rotatoes to the angle of the red car.
Left Arrow - Rotate white car CCW
Right Arrow - Rotate white car CW
Hold down UP arrow to change the rotation of the red car. For some peculiar reason it does the opposite..sometimes.
What happens to the car? Is it like this?
I find it peculiar that if Rotate to Angle is in fact supposed to take the shorted path that, even with the rotations clearly displayed, it clearly doesn't.
I have a game where I have an object rotate and it works on key presses and also touches etc. that could emulate the cars from micromachines if you added some acceleration based on the self.rotation direction.
With this if you key press down left it goes anti clockwise and the opposite for right - if one is down and you press the other it overrides then goes back.
If you let go at 120 degrees it will just stay there however.
From your project it seems like you want the car to always go back to 0 degress tho?
Is that right?
Cheers, M@
http://www.deepblueapps.com/gs-racerz-template/