Ease In & Out with Constrain Attribute, Not Interpolate
ericzingeler
Member Posts: 334
So I'm constraining an actor's position based on another actor's position.
Example:
Actor 2 PosX = Actor 1 PosX + 100
Actor 2 PosY = Actor 1 PosY + 100
The problem is, Actor 2 has camera control so when it's position changes, the camera jerks. I'm looking for a nice smooth transition, something like Ease In, Ease Out in the Interpolate function. I'm not using Interpolate because I'm trying to minimize rules and have the movement based on distance and not time.
Any ideas?
Thanks a bunch!
Example:
Actor 2 PosX = Actor 1 PosX + 100
Actor 2 PosY = Actor 1 PosY + 100
The problem is, Actor 2 has camera control so when it's position changes, the camera jerks. I'm looking for a nice smooth transition, something like Ease In, Ease Out in the Interpolate function. I'm not using Interpolate because I'm trying to minimize rules and have the movement based on distance and not time.
Any ideas?
Thanks a bunch!
Best Answer
-
Braydon_SFX Posts: 9,273If I remember correctly, constrain is ALWAYS checking to see if something changes. So interpolate should be the way to go.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Answers
Add to Actor 2 a self attribute named "Speed" and give it a value of 10.
Then on the same actor add this two constraints:
--Constrain attribute self.PositionX to self.speed*(actor1posX-self.PositionX)
--Constrain attribute self.PositionY to self.speed*(actor1posY-self.PositionY)
I adapted this method from a paddle that follow the mouse position so I'm not sure if it will work on your case. And I also can't remember where I saw this rule to give proper credits in case it works