Topic: [request] lerp(initial value, final value, time)

not only as a math function, but could also be integrated in the player code in order to give smooth rotations.

https://image.ibb.co/kuSYrm/SD_sml.pnghttps://image.ibb.co/kHq8P6/SeD_sml.pnghttps://image.ibb.co/cJf8P6/LTot_W_sml.png

Re: [request] lerp(initial value, final value, time)

KZR wrote:

not only as a math function, but could also be integrated in the player code in order to give smooth rotations.

okay, the math function has been added to rev760:
http://opensnc.sourceforge.net/wiki/ind … _functions

what do you mean by smooth rotations in the player code? In the loops?

Re: [request] lerp(initial value, final value, time)

yes loops and slopes in general. for example, when a floor with a different angle is stepped on, the player sprite would rotate smoothly to the new angle.

In construct 2 i found this very pleasant when i was building the physics system.

anglelerp(PhysicsActor.Angle, PlatformMask.Angle , dt*8)

Last edited by KZR (2013-10-29 13:22:25)

https://image.ibb.co/kuSYrm/SD_sml.pnghttps://image.ibb.co/kHq8P6/SeD_sml.pnghttps://image.ibb.co/cJf8P6/LTot_W_sml.png

Re: [request] lerp(initial value, final value, time)

the code sound good but also very complicated. how do you script that?

Re: [request] lerp(initial value, final value, time)

hmm, maybe we can put an option in the character file that indicates that the angle of rotation must be smooth? If I remember correctly, the engine already returns smoother angles during a loop, but I deliberately truncated the values, so we'd have the behavior we have now.

Re: [request] lerp(initial value, final value, time)

yeah, i saw you have an angle lookup table. Which is not bad, by any means, but on abrupt angle changes there is no smooth rotation. The player simply snaps from one angle to another.

https://image.ibb.co/kuSYrm/SD_sml.pnghttps://image.ibb.co/kHq8P6/SeD_sml.pnghttps://image.ibb.co/cJf8P6/LTot_W_sml.png

Re: [request] lerp(initial value, final value, time)

so, if you had a abrupt angle change, the rotation would change smoothly in a certain speed? What if we had a command, say, set_player_angle? this behavior you say could be scripted, since we already have a brick_angle() function, in addition to lerp().

Re: [request] lerp(initial value, final value, time)

curious you mentioning it, i was looking in the API if such thing existed. That would be cool for this and many other purposes.
But one thing strikes me, would it change the "internal" angle too (The physics actor angle, given upon brick collision), or just the angle of the player sprite? The reason for this question is that one could rotate the player entity and lose the correct angle given by the platforms, which could lead to some weirdness. If only the player sprite is rotated, the PA would still return correct angles, no matter how rotated the sprite is.

https://image.ibb.co/kuSYrm/SD_sml.pnghttps://image.ibb.co/kHq8P6/SeD_sml.pnghttps://image.ibb.co/cJf8P6/LTot_W_sml.png

Re: [request] lerp(initial value, final value, time)

no, only the angle of the graphical sprite