Announcement

Collapse
No announcement yet.

Smoothing out movement of camera limited by range

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Smoothing out movement of camera limited by range

    Hey,
    I'm making camera movement system similar to Marvellous Miss Take.

    -Movement Range is maximum distance from the Camera to the target, below that value there should be no movement towards the target
    -When Cursor or Player reaches Movement Range camera should move towards them
    -When Cursor and Player both reach Movement Range camera should move to location where line between them is cut in half
    -Player should never get beyond set Movement Range

    What I have achieved so far

    Per tick:
    1. Calculate distances excluding y, from Camera to Player and Camera to Cursor
    2. Interpolate Camera towards Player when bools (distances) are met.
    3. Interpolate Camera towards Cursor when bools (distances) are met.
    3. If both are at maximum range I calculate point between them to get movement on a circle "effect"

    The big problem I have met is the fact that when I move for example towards Cursor and place cursor on the edge of the required distance for movement, the camera will stutter instead smoothly moving towards desired location.
    Second thing is that when both Cursor and Player are on the maximum distance and Cursor is placed on the edge of the required distance, the Camera will stutter again in a loop (though I realise it may be caused by once interpolating to the one point then to the other, but I have no idea how to do it differently).
    Last edited by Skrzeku; 10-27-2015, 10:24 AM.
Working...
X