feat: Update smooth_script
This commit is contained in:
parent
f86ae657d2
commit
4ae4198033
|
|
@ -9,14 +9,14 @@ AFRAME.registerComponent("lerpsmooth", {
|
|||
if (this.el.object3D.visible) {
|
||||
// also make the object-to-smooth visible
|
||||
this.target.setAttribute('visible', 'true')
|
||||
this.target.object3D.rotation.setFromVector3(this.el.object3D.rotation.toVector3())
|
||||
// if we know about the previous position
|
||||
if(this.prevPosition) {
|
||||
// smooth position
|
||||
this.target.object3D.position.lerp(this.prevPosition, 0.1)
|
||||
|
||||
// smooth rotation
|
||||
let rot = this.target.object3D.rotation.toVector3().lerp(this.prevRotation, 0.1)
|
||||
this.target.object3D.rotation.setFromVector3(rot)
|
||||
// let rot = this.target.object3D.rotation.toVector3().lerp(this.prevRotation, 0.1)
|
||||
}
|
||||
// we don't know about the previous position
|
||||
else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue