|
@@ -84,7 +84,7 @@ export default class RapierMovementController extends RE.Component {
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
- this.scaledVelocity.set(0,0,0)
|
|
|
+
|
|
|
if(this.thrust) {
|
|
|
this.moveForward(1 * this.speed)
|
|
|
}
|
|
@@ -160,12 +160,13 @@ export default class RapierMovementController extends RE.Component {
|
|
|
let newRotation = new THREE.Quaternion()
|
|
|
newRotation.setFromEuler(euler)
|
|
|
const nextRotation = this.convertRapierToThreeQuat(this.bodyComponent.body.rotation())
|
|
|
- nextRotation.slerp(newRotation, 1)
|
|
|
+ nextRotation.slerp(newRotation, this.rotationSpeed * RE.Runtime.deltaTime)
|
|
|
this.bodyComponent.body.setNextKinematicRotation(nextRotation)
|
|
|
} else {
|
|
|
forwardVector = this.objectVectorCalculator.getForward()
|
|
|
}
|
|
|
|
|
|
+ this.scaledVelocity.set(0,0,0)
|
|
|
this.scaledVelocity.addScaledVector(forwardVector, distance)
|
|
|
|
|
|
this.velocity.x += this.scaledVelocity.x
|
|
@@ -178,19 +179,21 @@ export default class RapierMovementController extends RE.Component {
|
|
|
if(this.useCameraForward) {
|
|
|
rightVector = this.cameraVectorCalculator.getRight()
|
|
|
|
|
|
- // let euler = new THREE.Euler(0,0,0, 'XZY')
|
|
|
- // euler.setFromQuaternion(RE.Runtime.camera.quaternion.normalize())
|
|
|
- // euler.x = 0
|
|
|
- // euler.z = 0
|
|
|
- // let newRotation = new THREE.Quaternion()
|
|
|
- // newRotation.setFromEuler(euler)
|
|
|
- // const nextRotation = this.convertRapierToThreeQuat(this.bodyComponent.body.rotation())
|
|
|
- // nextRotation.slerp(newRotation, RE.Runtime.deltaTime)
|
|
|
- // this.bodyComponent.body.setNextKinematicRotation(nextRotation)
|
|
|
+ let euler = new THREE.Euler(0,0,0, 'XZY')
|
|
|
+ euler.setFromQuaternion(RE.Runtime.camera.quaternion.normalize())
|
|
|
+ euler.x = 0
|
|
|
+ euler.z = 0
|
|
|
+ let newRotation = new THREE.Quaternion()
|
|
|
+ newRotation.setFromEuler(euler)
|
|
|
+ const nextRotation = this.convertRapierToThreeQuat(this.bodyComponent.body.rotation())
|
|
|
+ nextRotation.slerp(newRotation, this.rotationSpeed * RE.Runtime.deltaTime)
|
|
|
+ this.bodyComponent.body.setNextKinematicRotation(nextRotation)
|
|
|
|
|
|
} else {
|
|
|
rightVector = this.objectVectorCalculator.getRight()
|
|
|
}
|
|
|
+
|
|
|
+ this.scaledVelocity.set(0,0,0)
|
|
|
this.scaledVelocity.addScaledVector(rightVector, distance)
|
|
|
// this.rapierScaledVelocity.x = this.scaledVelocity.x
|
|
|
// this.rapierScaledVelocity.y = this.scaledVelocity.y
|