How to use lerp on an entity?

Hi, I have worked out how to use lerp

var a = new pc.Vec3(0, 0, 0);
var b = new pc.Vec3(0, 0, 22.5);
var r = new pc.Vec3();

r.lerp(a, b, 0);
r.lerp(a, b, 0.5);
r.lerp(a, b, 1);

but how to apply this to an entity?

Hello, I am usually not helping on regular basis (therefore the answer time can seem random => it is :slight_smile: )

  • if you did not get it:
    var a = this.app.root.findbyName(“yourFirstEntityName”).getLocalposition();
    var b = this.app.root.findbyName(“yourSecondEntityName”).getLocalposition();

‘0.5’ is equal to ‘50%’ of the way

1 Like