Ease In & Out with Constrain Attribute, Not Interpolate

ericzingelerericzingeler Member Posts: 334
edited May 2012 in Working with GS (Mac)
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!

Best Answer

Answers

  • MarkOnTheIronMarkOnTheIron Member Posts: 1,447
    Try this:

    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 :)

  • ericzingelerericzingeler Member Posts: 334
    Try this:

    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 :)

    I'll give this a shot, thanks.
  • ericzingelerericzingeler Member Posts: 334
    If I were to choose Interpolate, anyone have a function to convert distance to time?
  • ericzingelerericzingeler Member Posts: 334
    If I were to choose Interpolate, anyone have a function to convert distance to time?
    Never mind, I can figure that one out. I'll give both Constrain and Interpolate a shot and see what works out better.
Sign In or Register to comment.