Search the Community
Showing results for tags 'rotationquaternion'.
Found 3 results
Hello! I have a few questions/concerns about how the latest (1.2.30 as for now) version of 3ds max extractor works. Not 100% sure it's the right place for questions like these, but maybe someone could at least help me with the research : ) It seems that the extractor adds the "rotationQuaternion" property for every mesh, disregarding the "Export quaternions instead of Euler angles" checkbox in the scene properties window (this checkbox seems to only affect whether the "rotation" property of meshes contains non-zero values). So as BabylonJS (we use 3.3.0-beta.4) mesh parser uses "rotationQuaternion" as a priority property while parsing the .babylon files, it becomes impossible to work with the "rotation" property of a mesh. Is there a way to work around this and be able to not export "rotationQuaternion" in the .babylon files? Is it true that on every export the exporter generates new meshes/materials ids, even if the source hasn't changed? Does it mean that in the code it's better to rely on mesh/material name, rather than its id? It seems that some time ago the way the exporter generates names for texture image files has changed (for example what was "sphere_mat_metallicRoughness.jpg" became "sphere_rsphere_m.jpg"). Is it possible to control the pattern of the texture files naming somehow (just to make sure it won't change any more at some point in the future)? Thank you! Additional info: we've recently updated the 3ds max extractor plugin to version 1.2.30, the previous version that we used is unknown, but presumably it was a couple of months old.
Hello everyone, I want to set my DeviceOrientationCamera initial rotation. I dig forum and found something about resetToCurrentRotation() but im not able to make it work. I want my DeviceOrientationCamera start with looking a target like ArcRotateCam What i mean by this I place my cam to right place but it look to wrong direction for initial position. cam = new babylon.DeviceOrientationCamera("DeviceOrientationCamera", position, scene); cam.rotationQuaternion.y = Math.PI / 2; cam.resetToCurrentRotation(); For example i want to turn my DeviceOrientationCamera X degree in Y axis then start controlling with device. What should i do? Thanks in advence!
It seems that from BJS2.3 to BJS2.4 to BJS2.5 the function toEulerAngles when applied to a quaternion has been reinterpreted and changed. The confusion has probably arisen because there can be many interpretations of Euler Angles and how they are applied. In BJS2.3 the toEulerAngles function was - given an orientation in quaternion form supply the Euler Angles that can be applied using the ZXZ convention to produce the same rotation. In BJS2.5 the function toEulerAngles is - given an orientation in quaternion form supply the Euler Angles in the order x, y, z that can be used as parameters for mesh.rotation In BJS2.4 I can see the reasoning was to add potentially more conventions but work with the same intention as for BJ2.3. In other words I think the intention for BJS2.3 and BJS2.4, in a limited way, was knowing an orientation through a quaternion, then for any given convention quaternion.toEulerAngles(convention) would return the alpha, beta, gamma to be used for that convention to produce the same rotation, ie an inverse function EULER-->QUATERNION, CONVENTION-->EULER. In BJS2.5 knowing an orientation through a quaternion, then quaternion.toEulerAngles() returns three angles to be plugged into mesh.rotation ie EULER-->QUATERNION-->NEW EULER ANGLES FOR CONVENTION ZXY in order x, y, z My questions are - Is the interpetation used in BJS2.5 the one wanted? IMHO the answer is yes it is probably what most people expect, though the original author will, I expect, not agree? Any breaking changes issues that anyone is worried about? Anybody require the inverse type interpretation as of 2.3 and 2.4 (if so new additional functions will be necessary) If 1 and not 2 then I would drop the order parameter entirely and make sure that in the documentation for the classes BJS2.5 toEulerAngles and toEulerAnglesToRef it is clear that the intention is to return three Euler Angles that can be plugged into mesh.rotation. @adam you may like to consider the above as I believe you PRd the changes for BJS2.5 More words for those who wish to read further. In BJS mesh.rotation uses one particular interpretation which is - for three "Euler Angles" alpha, beta and gamma with alpha about axis x, beta about axis y and gamma about axis z then mesh.rotation = new BABYLON.Vector3(alpha, beta, gamma) applies these in the order about z, about x about y using world axes This can be seen by applying mesh.rotate(BABYLON.Axis.Z, gamma, BABYLON.Space.WORLD); mesh.rotate(BABYLON.Axis.X, alpha, BABYLON.Space.WORLD); mesh.rotate(BABYLON.Axis.Y, beta, BABYLON.Space.WORLD); directly after the mesh has been created. Since using rotate produces a rotationQuaternion for the mesh you then do mesh.rotationQuaternion.toEulerAngles() which in BJS 2.5 returns alpha, beta, gamma (in order x, y, z) but didn't in BJS2.3 or BJS2.4 ___________________________________________________________________________________________________________ Now take a different convention with alpha, beta, gamma as Yaw, Pitch, Roll about y (as vertical), x and z all applied around local axes. Applying mesh.rotate(BABYLON.Axis.Y, Yaw, BABYLON.Space.LOCAL); mesh.rotate(BABYLON.Axis.X, Pitch, BABYLON.Space.LOCAL); mesh.rotate(BABYLON.Axis.Z, Roll, BABYLON.Space.LOCAL); directly after mesh creation then mesh.rotationQuaternion.toEulerAngles() returns Pitch, Yaw, Roll which are the angles in the order x, y, z for slotting into mesh.rotation mesh.rotate = new BABYLON.Vector3(Pitch, Yaw, Roll) produces the same rotation. Note BJS2.3 and BJS2.4 do not produce useful values for the convention ZXY. ____________________________________________________________________________________________________________________________________ Finally take a third convention alpha, beta, gamma in the order around z, then x then z as world axes. Apparently this is a fairly standard convention when used with local axes but for reasons that should become apparent I will stick with world axes. Applying mesh.rotate(BABYLON.Axis.Z, alpha, BABYLON.Space.WORLD); mesh.rotate(BABYLON.Axis.X, beta, BABYLON.Space.WORLD); mesh.rotate(BABYLON.Axis.Z, gamma, BABYLON.Space.WORLD); directly after mesh creation then mesh.rotationQuaternion.toEulerAngles() returns alpha, beta, gamma in BJS2.3, nothing useful in BJS2.4 and in BJS2.5 three angles theta, phi, psi in the order x, y, z which can be plugged straight into mesh.rotation to give the same orientation eg mesh.rotation = new BABYLON.Vector3(theta, phi, psi); Summary So in BJS2.3 the function toEulerAngles when given an orientation in quaternion form returns the Euler Angles that can be applied using the ZXZ convention to produce the same rotation. In BJS2.5 the functionf toEulerAngles when given an orientation in quaternion form returns the Euler Angles in the order x, y, z that can be used as parameters for mesh.rotation