Do i need a timer here?
Threepwood
Member Posts: 30
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?
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
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?
If I want to interpolate an actor every frame, is a timer the accepted way to do that?
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.
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.
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.