Tween Behavior - "tweening" to angle of another object

  • .C3P file https://www.dropbox.com/s/xt8w2rywggvvo30/The%20Getaway.c3p?dl=1

    The new Tween behavior recently got added and Ashley is still working on the documentation...

    In the meantime, I was wondering if anyone has had any success in better understanding the nuances of the behavior than I have...

    I'm trying to create a somewhat "dynamic" camera system for a racing game I'm working on.

    The Camera object is pinned to the far end of an object "camera arm" which I've called "Selfie Stick". The Selfie Stick is likewise pinned to the Car object.

    When the Car accelerates, the Selfie Stick extends in length, lerping based on Speed/MaxSpeed of the Car. This begins the set-up of the Camera "leading" ahead of the Car. This part works just fine.

    When the Car turns left or right, the Selfie Stick is to rotate to the Car.Angle +/- 10. Of course, if the Car is not turning, the Selfie Stick "rests" at Car.Angle = 0. This way the Camera also "leads" at angles, too. I want this to be a smooth transition, even if the player quickly alternates between turning left or right or not turning at all.

    I'm trying to use the Tween behavior (assigned to the Selfie Stick) so that it smoothly transitions to the +/-10 value relative to the Car object's angle.

    The problem is when I start turning - even just tap the left/right arrow keys - the Selfie Stick object begins rotating rapidly and will not stop, even after the Car has completely ceased all movement.

    Previous sample projects to test out how the Tween behavior worked resulted in things happening mostly as I thought they should. But I do not understand why the Selfie Stick object overshoots the Car.Angle value and never stops.

    Help, please?

    ========

    EDIT: I did further testing and I discovered something interesting.

    I created a single sprite and set it so that it moves 50 up/down/left/right depending on which keyboard arrow is pressed (event: on pressed). While the sprite is moving its 50 pixels but not yet reached its goal if the key is pressed again in the same direction, it "adds by overlap" (probably not an accurate phrase, but it's the best I can think of to explain it) another 50 pixels to Tween to. The result is that the sprite is now moving faster - or faster for the amount of "overlap".

    This would help explain why my Selfie Stick object begins spinning wildly even after the briefest tap of the left/right arrow keys while turning. For however many ticks passed, that's +/- 10 degrees "overlapping" and so the object continues to Tween until it has finished processing each set of 10. (@Ashley, can you confirm this is more-or-less accurate, please?)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It's a bug, I reported it here:

    github.com/Scirra/Construct-3-bugs/issues/2216

    Please comment on github if you have anything to add to my description.

  • OH MY GOODNESS! You have totally given me great relief! Thank you!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)