Do i need a timer here?

ThreepwoodThreepwood Member Posts: 30
edited November -1 in Working with GS (Mac)
I have an actor, that's a camera object to follow.

The actor is as follows:

- Control Camera
- Rule: if facing left, Interpolate camera to a position, otherwise Interpolate to a different position.

That's the entire actor.

Now, then it works if I wrap the entire thing in a Timer that executes every 0 seconds. If i don't do that, the above Interpolations only execute once? Is that the correct way to do this? Seemed like bad use of a timer and logically, it seems the above actor would just execute every frame, and I wouldn't need the timer.

What am I missing?

Comments

  • ThreepwoodThreepwood Member Posts: 30
    Basically, why do I need a timer to say that every .1 secs, I should interpolate?

    Even if I put in a rule that's true every frame like (if playerX > 0) then interpolate, it still only happens once. I can't get the interpolate to fire off unless I wrap it in a timer.

    Is this a bug, or how it works?
  • ThreepwoodThreepwood Member Posts: 30
    I'm still curious about this...

    If I want to interpolate an actor every frame, is a timer the accepted way to do that?
  • synthesissynthesis Member Posts: 1,693
    You may need to first constrain the X and Y position to a game attribute. Then tie a separate camera controller actor to the game attributes.

    I always use an invisible actor called cameraController. Then constrain it to whatever influences need to be constrained to. You can then use rules in the controller to determine what X and Y values to constrain or change to and use boolean switches to turn the different behaviors on and off. Allow the camera to operate independently (but in tandem) to the main game actor.

    That might help you get better control over the camera.

    You should not need to use a timer in this instance. A constrain will act the same way as a 0 timer but will be more efficient in the processing.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Interpolations only fire once.
    The Interpolation behavior is basically a tweening engine.
    By putting them in a Timer, they are constantly starting over from the new position.
    Definitely not the best way to handle that.

    As a start, I would try the Move and Move To behaviors.

    For an even better solution, check out the latest 'waypoints' demo by ORBZ, it shows how to create constant motion without using Interpolations or Move To behaviors.

    You could try modifying that code to fit your needs.
  • ThreepwoodThreepwood Member Posts: 30
    Thanks guys. The docs should be more clear on things like Interpolations firing just once, etc.

    I was able to replicate the camera movement with MoveTo and just interpolating the camera on direction changes and when you stop. The key thing was that you want a smooth camera movement when you stop, vs an abrupt one. It's just polish.

    It'd be nice if they maybe added the ease in/out functionality with MoveTo.
Sign In or Register to comment.