I am trying to find an interpolation method which creates an elastic effect. By this I mean that the interpolation target can be exceeded to create a spring-like effect.
Is there a way to do this?
I am trying to find an interpolation method which creates an elastic effect. By this I mean that the interpolation target can be exceeded to create a spring-like effect.
Is there a way to do this?
a spring with damping can be described like this:
springAccel = -(springOffsetFromEquilibrium x springStiffness) - (springVelocity x Damping)
or you can use a physics constraint.
Reminds me of a chase camera for old games like Freelancer or a Star Wars based game.
An Attachable Camera Based Spring Arm:
Try looking in the example Flying Template, and check the Vehicle Template as well.
You could use the built-in PhysX to re-create it or should be able to find some documentation online where some old Flash or OpenGL examples used to be if you need the math formula for it. A Battlestar Galactica game also used it for chase camera if I remember correctly.
Also, good for Elastic Collisions for a Pool game, Pong, or Breakout.
The physics definition today may be more along the lines of Spring Physics, here’s the docs for the constraint:
The Content Examples blueprints has a physics chain on the pull switch, might check that out too for some ideas.
Can check out the Spring Linear Motor stuff here, it features the linear drive control, this is in the Content Examples for Physics Map:
https://docs.unrealengine.com/latest/INT/Resources/ContentExamples/Physics/1_7/index.html
Properties:
https://docs.unrealengine.com/latest/INT/Engine/Physics/PhAT/Properties/index.html
A Previous Spring Constraint Question:
The Vehicle Advanced Template example uses a spring for the antenna.
How can I use that calculation to interpolate?
Here is what I am doing:
float Loc = FMath::InterpExpoOut(Loc, 0.0f, InterpSpeed);
How can this be replaced by your above method?
i have no idea why you would plug something called InterpSpeed into a function that wants an alpha value… did you mean InterpPosition? also, springs don’t have alpha values, because they are not like a linear interpolation or a quadratic interpolation. Springs are more of a physical simulation of potential energy storage, rather than a relationship between input and output pairs. a spring is not a math function that can be plotted, it updates based on feedback.
EventTick()
{
springOffsetFromEquilibrium = SpringPos - SpringTarget ;
springAccel = -(springOffsetFromEquilibrium * springStiffness) - (springVelocity * Damping) * deltaSeconds;
springVelocity += springAccel;
SpringPos += springVelocity * deltaSeconds;
}
Thanks for the response. However I don’t think this is what I am looking for. I am looking for an effect shown in this video: https://www.youtube.com/watch?v=_MFX048gfbI