negative Angular Velocity / Rotation issue
RondoRocket
Member Posts: 411
Attached a test file made with the latest Release Candidate.
I'm using a Constrain Attribute to smoothen out the rotation of an actor based on the rotation of another actor using this code: self.motion.angular.velocity To: self.Ease *( game.Rotation - self.Rotation )
The problem is I seem to be getting a weird spinning issue with the orange actor each time is does a full revolution.
Just curious if any of the math wizards here have a solution or suggestion.
Thanks!
Twitter:rondorocket
Web: rondorocket.com
Comments
Can you upload a test project?
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
can you specify wich attribute is integer/angle/index?
I'm going to put together a test project and see if I get the same results… if so I'll post it. Thanks for the help!
Twitter:rondorocket
Web: rondorocket.com
Attached a test file to my original post at the top. It was made using the latest Release Candidate. The orange actor is the issue, you can see once it does a full revolution it does a spin. I'm assuming it's happening when it reaches 360 and resets to 0?
Thanks for any help.
Twitter:rondorocket
Web: rondorocket.com
I can see it is doesn't like it when game.2Rot and self.Rotation rollover from 359 to 0 in Actor 3. There is a period between Actor 2 resetting to 0 and before Actor 3 resets to 0 when these values are vastly different which causes the actor to rotate. Maybe you could try and find a way to keep it incrementing instead of resetting to 0. I think creator would regard 360 degrees as 0 degrees 361 as 1 and so on.
Universal Binary Template - Universal Binary Template Instructions Rev 4 (Short) - Custom Score Display Template
I'm not sure what context this is being used in - so my solution might not be right for you - but I'd be tempted to simply copy the motion of the purple actor to the orange actor and then offset the angle that sin and cos are operating on . . .
Also when matching the rotation of an object to a circular path (to keep it aligned to the path) I usually just copy the speed of the actor instead of using VectorToAngle - we already know the speed the object should be rotating at so it seems a little cruel to make GameSalad calculate a value we already know, I'm a big fan of making GameSalad (and your end device's processor) do as little work as it needs to.
So for the purple actor I'd do this:
And then simply do the same for the orange actor but with an offset on the angle:
I used 12° as it matches what you currently have, but you can of course stick whatever you need in there, doing it this was gets rid of a few attributes and unneeded calculations . . . . . but like I say without knowing how this stuff works in your actual game it might not be suitable ?
Let me make a quick demo . . . back in a minute . . . . .
Demo as described above:
https://www.mediafire.com/?tc2caq368btj9cc
Demo as your original, but replacing angular velocity with constrain rotation:
https://www.mediafire.com/?37m3mdyv8ub7gk6