# ferat

Members

10

• Rank
Member
1. ## How can I rotate my plane correctly?

Flight movement solved in this playground: https://www.babylonjs-playground.com/#P394JW#3 Now quaternions make more sense for me ðŸ˜Š I found that the problem I was facing is called "Gimbal Lock" using Euler Angles. But I still have a small problem: when rotating the X axis using quaternions, the rotation breaks on 90 degress/radians and -90 degress/radians. To "solve" it, I limited the X axis rotation to a max of 85 degrees/radians. Is there another way to avoid this issue? I noticed that this only occurs in X axis. Rotating on Y anz Z axis has no limitations and I can make full 360 degress rotations. To reproduce the problem, please modify the line 73 to more than 90 degrees, Eg: var maxPitchAngle = (120 * (Math.PI / 180)); Thanks for attention!!
2. ## How can I rotate my plane correctly?

Hey guys, I'm trying to make a simple flight simulation, but I have some issues trying to rotate my plane. Currently, I have this code: EDIT: I created a playground to exemplify better my problem: https://www.babylonjs-playground.com/indexStable.html#HT1PHY#5 var elapsed = engine.getDeltaTime() / 1000; // handle keys if(keysDown[87]) { // W, rotate in the negative direction about the x axis pitch += elapsed * turnSpeed; } if(keysDown[83]) { // S, rotate in the positive direction about the x axis pitch -= elapsed * turnSpeed; } if(keysDown[65]) { // A, rotate left yaw -= elapsed * turnSpeed; roll += elapsed * turnSpeed; } if(keysDown[68]) { // D, rotate right yaw += elapsed * turnSpeed; roll -= elapsed * turnSpeed; } var translationVector = new BABYLON.Vector3(0, 0, 1).normalize(); var rotationQuaternion = BABYLON.Quaternion.RotationYawPitchRoll(yaw, pitch, roll); // Apllying translation and rotation to the plane controlCraft.rotationQuaternion = rotationQuaternion; controlCraft.translate(translationVector, elapsed + airSpeed, BABYLON.Space.LOCAL); I want to rotate the plane ever considering its "Forward Axis", but when I rotate it to the left or right and press W/S, the pitch doesn't work correctly and the plane yaws, instead of pitching. How can I fix it? I'm trying to make it with Quaternions, but I don't know the correct path. Thanks very much for the help!!
3. ## Fixed Scene Background

Thanks @Deltakosh!!
4. ## Fixed Scene Background

Is there any way to save a screenshot with this layer of background? I am using BABYLON.Tools.CreateScreenshot but always creates an image with a transparent background. For now, I'm using canvas.toDataURL ("image / png"), keeping the preserveDrawingBuffer to true to be able to save the full picture. Thanks
5. ## Fixed Scene Background

This is Awesome!!! Thanks very much @Wingnut!! This works perfectly for me.
6. ## Fixed Scene Background

Hi, I have an application that uses BabylonJS: http://rapidmockup.topempresas.net/ As you see, i have a skybox with 3D backgrounds and a ArcRotateCamera in my scene. This works well, but i need a second behavior in my scene. When the user select an option, i need to rotate only the object and the plane in my scene, but not the background. It is because i need a option to user add your own backgorund image, but users will upload only one texture, and the background skybox must be fixed to see only one face. Is it possible? How to make it? Thanks by the support!
7. ## Memory is not released in Chrome

Thanks @dungtm. I will scan my code for references. Thanks a lot for your help!!
8. ## Memory is not released in Chrome

I have a similar problem with my app (using NW.js to run in Desktop Mode) . When i click a button, I call the code below: resetScene: function(meshName) { scene.dispose(); return this.createNewScene(meshName); //Creates a new scene } The scene.dispose() works well, but the memory is not released. And I have the same problem with material.dispose(), always that i call it, the memory is not released. When I create a new material, the memory increases. What can i do to solve this? Thanks a lot