[SOLVED] How to check Camera is moving or stop?

How to check Camera is moving or stop?
When the camera entity as a child to the player entity???

Is it possible to get entity this.entity.translate x value???

Thank you very much

Hi @supsersuperman,

You can do something like this to check if the camera has moved or not, using the equals method available on the pc.Vec3 class:

var CameraMoved = pc.createScript('cameraMoved');

// initialize code called once per entity
CameraMoved.prototype.initialize = function() {
    this.camera = this.app.root.findByName('Camera');
    this.prevPos = new pc.Vec3();

// update code called every frame
CameraMoved.prototype.update = function(dt) {
    var pos = this.camera.getPosition();
    if( this.prevPos.equals(this.camera.getPosition()) === false){
1 Like