Scale is not a method of Vec3


I was modifying the default orbit-camera script to make it ES6 compliant when I noticed something:

OrbitCamera.prototype._updatePosition = function () {
// Work out the camera position based on the pivot point, pitch, yaw and distance
this.entity.setLocalPosition(0, 0, 0);
this.entity.setLocalEulerAngles(this._pitch, this._yaw, 0);
var position = this.entity.getPosition();

Position is Vec3 and that class doesn’t have a method called scale. Where does it come from? What does it do?

(I replaced it with a mulScalar)

good find!
We used to have Vec3.scale, but that was deprecated and is now called mulScalar.
We still have this function in deprecated.js, so it still works. But I’ll go and fix those few remaining uses of .scale shortly.

1 Like

Fixed here Replace the use of deprecated Vec3.scale by Vec3.mulScalar in camera scripts by mvaligursky · Pull Request #5220 · playcanvas/engine · GitHub