• Content Count

  • Joined

  • Last visited

  1. Here my problem : http://jsfiddle.net/JulienGobin/BZ4A4/ As i said I got the good euler <-> quat <-> matrix conversions, you can see that trying to use these commands in the console after clicking on the "Use euclideanspace conversions" button : euler <-> quat var e = new BABYLON.Vector3(0.1, 0.2, 0.3); var q = BABYLON.Quaternion.RotationYawPitchRoll(e.y, e.x, e.z); console.log(e); // BABYLON.Vector3 {x: 0.1, y: 0.2, z: 0.3} console.log(q.toEulerAngles()); // BABYLON.Vector3 {x: 0.09999999999999999, y: 0.2, z: 0.30000000000000004} quat <-> mat var m = BABYLON.Matrix.Identity(); q.toRotationMatrix(m); console.log(q); // BABYLON.Quaternion {x: 0.06407134770607098, y: 0.09115754934299045, z: 0.14357217502739153, w: 0.983347443256353} console.log(m.toQuaternion); // BABYLON.Quaternion {x: 0.06407134770607098, y: 0.09115754934299045, z: 0.14357217502739153, w: 0.983347443256353} But i don't got the good rotation (euler order are wrong). I'm working trying to fixe that.
  2. (Sorry, again, for the long time past) I still have some issue. I got the good euler -> quaternion and quaternion -> euler conversion (and the good quaternion -> matrix and matrix -> quaternion conversions) But, currently my math use a XYZ and not a YXZ euler order rotation, i'm working on it.
  3. It works (according to many test) but ... i'm not 101% sure that no math-mistake have slipped themself into my code. Prefer double-triple check before send a pull request ^^' (maybe today).
  4. (Sorry for the long time past) I've got something right now : http://jsfiddle.net/JulienGobin/BZ4A4/ Some improvement still has to be done. And I'm not sure why it's needed to multiply by -2 instead of 2 during the quaternion to matrix conversion. I'll look deeper as soon as possible.
  5. I found something else when i look deeper in the blender exprot to babylon (maybe not really realated to this problem i made a fork) : http://www.html5gamedevs.com/topic/3293-amera-rotation-error-during-blender-export/
  6. Maybe related to this first problem : http://www.html5gamedevs.com/topic/3159-quaternionrotationyawpitchroll-parameters-and-toeulerangles-result-should-be-the-same/ When i try some rotation-exportation from blender to babylon i found a problem. Here my scene in blender : (download here : http://dfiles.eu/files/m1dcdze18) As you can see the camera is not looking toward the object. but when i import the full scene on babylon js i can see this : (download here : http://dfiles.eu/files/w4etjfuh6) Looking deeper in the .babylon it seems that the exporter set a target on the camera (and not a rotation ?). "cameras": [{ "name": "Camera", "id": "Camera", "position": [4.0000, 1.5000, 4.0000], "target": [0.0000, -1.0000, 0.0000], "fov": 0.8576, "minZ": 0.1000, "maxZ": 100.0000, "speed": 1.0000, "inertia": 0.9000, "checkCollisions": false, "applyGravity": false, "ellipsoid": [0.2000, 0.9000, 0.2000]}],And it seems that this target is actually set in the camera during the parsing (in babylon.sceneLoader) var parseCamera = function (parsedCamera, scene) { var camera = new BABYLON.FreeCamera(parsedCamera.name, BABYLON.Vector3.FromArray(parsedCamera.position), scene); camera.id = parsedCamera.id; // Parent if (parsedCamera.parentId) { camera._waitingParentId = parsedCamera.parentId; } // Target if (parsedCamera.target) { camera.setTarget(BABYLON.Vector3.FromArray(parsedCamera.target)); } else { camera.rotation = BABYLON.Vector3.FromArray(parsedCamera.rotation); }And ... strangely the target position is not rightly set according to the blender camera rotation matrix (but i dont look deeper inside the blender exporter).
  7. I'm not absolutely sure. Here my test : First on babylon js using BABYLON.Quaternion.YawPitchRoll with yaw = 0.1, pitch = 0.2, roll = 0.3 (assuming it's in radians) q = (x: 0.10602051106179562, y: 0.034270798550482096, z: 0.1435721750273919, w: 0.9833474432563558). Second using the Calculator on this page http://www.euclideanspace.com/maths/geometry/rotations/conversions/eulerToQuaternion/index.htm (at "Angle Calculator and Further examples"): - with heading = yaw, attitude = -roll, bank = pitch cause of the two differents conventions using by BabylonJS and euclideanspace.com (http://www.euclideanspace.com/maths/geometry/rotations/euler/index.htm) - after radian to degree conversion (using this : http://www.unitjuggler.com/convertir-angle-de-rad-en-deg.html) heading = 5.7295779513082, attitude = -17.188733853925, bank = 11.459155902616. q = (real: 0.9833474432563557, i: 0.0911575493429866, j: 0.034270798550482165, k: -0.153439302024225). If w = real and y = j (sounds logical) x != i and z != k (sounds a bit less logical). Did i miss something ? (wrong conversion maybe ?)
  8. I try something using math and conventions from here : http://www.euclideanspace.com/maths/geometry/rotations/euler/index.htm Euler to Quaternion : http://www.euclideanspace.com/maths/geometry/rotations/euler/index.htm Quaternion to Euler : http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/index.htm I get right Euler to Quaternion and Quaternion to Euler conversions but ... i got also some issues with the world matrix. http://jsfiddle.net/JulienGobin/BZ4A4/42/ It seems that the quaternion compute currently with the babylon js way are wrong (i hope it's not and i'm wrong, but after double-triple check the math and the convention ...).
  9. Thank for your reply, the new pull request (without the wireframe stuff) is here : https://github.com/BabylonJS/Babylon.js/pull/126 For the wireframe stuff i'm really surprised that this display mode is worst than the normal one. I will force myself on more test next time ^^'. (Edit : wrong link, my bad)
  10. Here it is https://github.com/BabylonJS/Babylon.js/pull/122
  11. Ok, thank for your fast reply . I'm already working on a system that makes the job. (Because i really need it), maybe i can send you a pull request when i have finished (tomorrow) ? (I'm also working on a system, based on this first one, that forces the wireframe display when the fps is shutting down when a camera is moving; of course it's optional and parametrable. Will you be interested by it ?). Here what i have done so far : http://jsfiddle.net/JulienGobin/7DT4R/ http://jsfiddle.net/JulienGobin/4QhX4/
  12. Hi everyone, First of all, happy new year and thanks for this amazing webgl engine. I noticed the view matrix of the camera is computed for each frame when BABYLON.Camera.prototype.getViewMatrix is called by BABYLON.Scene.prototype._renderForCamera (called by BABYLON.Scene.prototype.render). BABYLON.Camera.prototype.getViewMatrix is in two parts: this._computedViewMatrix = this._getViewMatrix();// BABYLON.Camera.prototype._getViewMatrix is overrided in sub-classes (ArcRotateCamera and FreeCamera compute for each frame a matrix and return it)and if (this.parent && this.parent.getWorldMatrix) { if (!this._worldMatrix) { this._worldMatrix = BABYLON.Matrix.Identity(); } this._computedViewMatrix.invertToRef(this._worldMatrix); this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._computedViewMatrix); this._computedViewMatrix.invert(); return this._computedViewMatrix; }which computes the view matrix if the camera has a parent. Is it on purpose that the view matrix is computed for each frame? Is it better for the memory? (instead of caching values like it's done for the meshes; BABYLON.Mesh.prototype.computeWorldMatrix)