Search the Community
Showing results for tags 'object rotation'.
-
I have a car with a 90 degree rotation in Blender on the Z axis. Which I am assuming that means the Y axis in BJS. .See attached screen grab. (the ground plane in BJS is on the X-Z plane). I have heading data encoded in degree format (360 = NORTH, 90=EAST). I am using the following equation to convert degrees to radians. this.translate = function (datum) { var lon = datum.geometry.coordinates[0]; var lat = datum.geometry.coordinates[1]; var y = datum.geometry.coordinates[2]; var heading = (datum.properties.heading / 360) * Math.PI; var x = (lon - self.map.West) * self.ground.xScale; var z = (lat- self.map.South) * self.ground.zScale; GLOBAL.state.x = x; GLOBAL.state.y = y; GLOBAL.state.z = z; GLOBAL.state.heading = heading; }(this is so trivial a problem and blushing to post it). But most of the time I get a car that is rotated at odd angles. What do I not understand about the Babylon coordinate system? https://github.com/BabylonJS/Babylon.js/wiki/03---Position,-Rotation-&-Scaling Oh yes, I am using a followCamera: this.switchCamera = function () { var dolly = new BABYLON.FollowCamera("FollowCam", self.scene.activeCamera.position, self.scene); dolly.rotation = self.scene.activeCamera.rotation; dolly.checkCollisions = true; dolly.applyGravity = true; dolly.ellipsoid = new BABYLON.Vector3(1, 1, 1); // collision ellipsoid dolly.heightOffset = 60; //height above the object dolly.rotationOffset = 0; // follow from the rear dolly.radius = 125; // how far from the object dolly.cameraAcceleration = 0.05 // how fast to move dolly.maxCameraSpeed = 20 // speed limit dolly.target = self.car; self.scene.activeCamera.detachControl(self.canvas); self.scene.activeCamera = dolly; self.scene.activeCamera.attachControl(self.canvas); }