Skip to content

SmoothRange and smoothReturnToRange() are broken #97

Description

@Ayreos

The values are correct at start and end points, but jump to massively incorrect ranges in-between.

The math is wrong:
float magicNumber = -(toMax - toMin) / 2;

wanting a smooth transition from 0 to 90 you get:
magicNumber = -(90-0)/2 = -45

It follows:
cos(t) * magicNumber + magicNumber + toMin = 1 * (-45) - 45 + 0 = -90.0

So at time 0.001 (time 0 is guarded) your smooth 0 to 90° function jumps at -90°, which is what happened to me trying to use it.

same error in smoothReturnToRange(). (The rest seems fine)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions