I need help with this code, as it doesn’t work, and I don’t know why. This code should totally work!!
var ShipMovement = pc.createScript('shipMovement');
// initialize code called once per entity
ShipMovement.prototype.initialize = function() {
//Movement Data
var mX = 100;
var mY = 0;
var mZ = 0;
//Liftoff Data
var liftoffX = 0;
var liftoffY = 5;
var liftoffZ = 0;
//Landing Data
var landingX = 0;
var landingY = -5;
var landingZ = 0;
//AngleChange Data
angleChange1 = [];
//Other Variables
var isFinished = false;
};
// update code called every frame
ShipMovement.prototype.update = function(dt) {
if(!isFinished) {
var currentPos = this.entity.getPosition();
//Lifetoff
entity.translate(liftoffX, liftoffY, liftoffZ);
//AngleChange1
//To be emplemented
//Main Movement
entity.translate(mX, mY, mZ);
//Landing
entitiy.translate(landingX, landingY, landingZ);
isFinished = true;
}
};
// swap method called for script hot-reloading
// inherit your script state here
// ShipMovement.prototype.swap = function(old) { };
// to learn more about script anatomy, please read:
// http://developer.playcanvas.com/en/user-manual/scripting/