feat: Update smooth_script

This commit is contained in:
omar salah 2024-06-14 01:38:50 +03:00
parent 22f2a26274
commit f5dba4e498
1 changed files with 2 additions and 2 deletions

View File

@ -12,10 +12,10 @@ AFRAME.registerComponent("lerpsmooth", {
// if we know about the previous position
if(this.prevPosition) {
// smooth position
this.target.object3D.position.lerp(this.prevPosition, 0.1)
this.target.object3D.position.lerp(this.prevPosition, 0.5)
// smooth rotation
let rot = this.target.object3D.rotation.toVector3().lerp(this.prevRotation, 0.1)
let rot = this.target.object3D.rotation.toVector3().lerp(this.prevRotation, 0.5)
this.target.object3D.rotation.setFromVector3(rot)
}
// we don't know about the previous position