Smooth out rotation of an actor
Creator97
Member Posts: 140
I have the actor A rotating to a x position of actor B which you can drag around. The problem is the rotation of actor A isn't smooth because you can drag actor B around how you want.
I have set up in actor A:
Constrain Attribute self.Rotation to game.ActorB X
How can I smooth that rotation, so that Actor A changes its rotation over time like with the interpolate attribute behavior set up with ease in and out?
Answers
Weird... I answered this this morning but it's not showing my post. Here goes again:
Are you seeing something different than in the attached demo? It looks pretty smooth to me.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
I edited my first post. No I am not seeing something different as in your demo. And yes it reacts smoothly exactly to the position of the dragging object.
out of my first post (Maybe you then now what I mean):
How can I smooth that rotation, so that Actor A changes its rotation over time like with the interpolate attribute behavior set up with ease in and out?
Imagine the arrow in your project is not an arrow it's a plane that you want to steer (with it comes the rotation: the one wing goes down and the other up when you would watch it from behind or front) with the object you drag. When it would rotate (normal left and right rotation of a plane when making a curve) like the arrow does it now it wouldn't look real, right?
So the problem isn't smoothness but speed. You want it to rotate more slowly?
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Rotate realistic. Did you understand what I am trying to explain with the airplane example? When you would drag actor B fast to the right at the max x position, the airplane would rotate to the max rotation of itself immediately but realistic speaking it should reach that maximum rotation over time but just when the actor B is still there and hasn't moved to another x position.
I do understand. You want the dragged actor to act as a control for the rotation but with a maximum speed. So you would need to limit the speed of the rotation. I don't think you can do that with a constrain behavior so you'll have to try one of the Rotate behaviors or use Interpolate. I'm not sure how exactly to do that.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Interpolate doesn't work for me and how should a rotate behavior work in that way? But it's ok it isn't that important so don't think about it. But now I know that I am not dumb.
"Realistic" rotation is in the eye of the beholder. One persons "realistic" is another persons 'fake'. I think what you might be after is some sort of expected behavior, based upon other games you have seen.
But you might try something like this:
Thanks. It's hard for me to get it working because I don't understand what you are saying here. Maybe that's because I am not that experienced with the expression editor.
What do you mean for example with self.AngleToTarget. There's no such attribute that I am aware of. What I discovered is that the expression "vectorToAngle" does exist.
For me it would be easier to understand it when it would be already a project file.
But I guess I would get it done alone, if I would have learned more about the editor itself. So you don't have to do that.
Wow thanks for the work. Even made with pictures that fit to the time of the year.