• Content Count

  • Joined

  • Last visited

About Phuein

  • Rank
    Advanced Member

Recent Profile Visitors

681 profile views
  1. I won't redo the entire docs for BJS. Only wanting to add a feature. I'll let the veteran developers decide if they want to redo it. I do agree with you that it should be done.
  2. I gave up on this idea for the time, yes. Nobody responded with a solution for adding Handlebars Helper functions, which is where I draw my line of bothering with this broken system. (Not being able to add simple JS to a webpage after hours of work means it's broken.) I'm not following you. How is anything you're saying solving this issue? Why do I need to parse BJS for this? Can you provide code that helps with the actual issue? I definitely don't want to write my own TypeDoc, that would be a waste of my time. I was looking to add a very small and simple letter-index to the existing docs, only.
  3. No, that isn't the aim. At its core, the desired goal is a "ghost in space." Not a spaceship. The spaceship option is secondary, and also more simple. A ghost in space would function like a human, with certain rules for roll-correction. Roll is definitely desirable. It just gets tweaked as you look around, similarly to how humans do it; attempting to maintain roll within certain boundaries to some extent.
  4. I don't get it... You just locked an axis. Using right/left arrow keys (per the instructions) doesn't roll. I don't want to lock an axis, as that doesn't represent free 3D movement. I'm not sure where we reached a misunderstanding. I wish somebody bothered to make a Cosmic Rift (SubSpace-esque) clone. For myself, I just enjoy going into the details. My project only has space movement as a small element.
  5. Cool deltakosh, I'll add to my notes to make a proper PG example for the docs. coolroar, why do you think UniversalCamera will be so similar to FlyCamera with immediate roll correction? Maybe it's better explained with your example of Pitching your head straight up (look at ceiling) and then Yawing your head to the side - thus seeing the world in a 90° Roll. If you only Yaw for 45°, your head automatically fixes the Roll by 45°. It eventually reaches 0° when your Yaw is complete at 90°. And with the added benefit of actual space and air flight integrated, I'm sure the goals are different enough to justify it (until an unexpected singularity!)
  6. FlyCamera as first draft is getting merged, so everyone can see and edit and suggest. (notice "fly" prefix.) It doesn't have inertia yet. It doesn't have Touch controls support yet. I'm back into my own project for the moment, so I'm still stumped with immediate Roll correction (mimic human head) too. Taking a break tends to help. You can make a PR, or post code suggestions here that I'll edit and integrate. 👻
  7. Roll correction and [non-physical] banking seem to work nicely. I still have no idea on how to figure out human-like Roll correction. Hopefully, more experienced coders can provide their input. [Link removed. FlyCamera is now available in BJS for experimenting.]
  8. UniversalCamera is just an added layer on top of FreeCamera that draws from the same MouseInput file. So it doesn't do that. I'm still experimenting, but still very stumped. I can't figure out how to produce mathematically the relationship between Pitch and Yaw with Roll, so that it fixes itself in the given conditions (as described above.)
  9. Agreed about having an option for banking/air-density. Also, an option to mimic a spaceship's momentum in space is valid, as well. However, I find myself stumped at figuring out how to add the [option for] Roll-correction (maintain Roll when Yawing and Pitching.) Boosting up my reading on Quaternions, but it's still not clear to me. Just like our heads do, the default for FlyCamera is to enable Roll-correction, so when users move around (like a ghost!) their view of the world only Rolls when they choose it to do so. Without locking them when Pitching at 90°! The logic would be: When the FlyCamera is Pitched beyond 0° (or Math.PI/2), and then any Yaw is applied, the necessary Roll is applied so that when the Yaw is at 0° -> Roll is also at 0°, and when Yaw is at 90° -> Roll is not modified from its current angle. Just like our human heads do it. Stumped... I made a slowCorrect option, which works nicely, but it's not the smart solution for this... So, stumped... To talk in code, here is slowCorrect: this._rollObserver = () => { if (! return; let limit = Math.round(_this._trackRoll * 10000) / 10000; // Target Roll. let z = Math.round( * 10000) / 10000; // Current Roll. let delta = limit - z; let rate = 100; // Higher means more time to rotate before fixed Roll. if (z !== limit) { // Change Z rotation towards the target Roll. += delta / rate; // Match when near enough. if (Math.abs(limit - <= 0.001) { = limit; } } } ); And here's some mess (DOES NOT WORK) from me experimenting with trying to apply Roll correction instantly, relying on coolroar's code: (Can play with FlyCamera and this function {look at bottom of PG code for "function rotateCameraTest"} at [Link removed. FlyCamera is now available in BJS for experimenting.]) var x = offsetX / this.angularSensibility; var y = offsetY / this.angularSensibility; // Initialize to current rotation. var currentRotation = BABYLON.Quaternion.RotationYawPitchRoll(camera.rotation.y, camera.rotation.x, camera.rotation.z); var rotationChange: BABYLON.Quaternion; // Yaw and Pitch by default. // Maintain global Roll. if (this.activeButton !== 2) { // Apply change in Radians to vector Angle. rotationChange = BABYLON.Quaternion.RotationAxis(BABYLON.Axis.Y, x); // Apply Yaw to quaternion. currentRotation.multiplyInPlace(rotationChange); // Apply change in Radians to vector Angle. rotationChange = BABYLON.Quaternion.RotationAxis(BABYLON.Axis.X, y); // Apply Pitch to quaternion. currentRotation.multiplyInPlace(rotationChange); // I could make it slowly auto-correct the Roll, but that would be stupid. if (!camera.slowCorrect) { // I want it to correct Roll live, like human heads do. // The problem is that immediate correction locks the Roll axis! // Pitch all the way up, and you can't Yaw to the side at all. // trackRoll is Roll. // Roll is 0 when Yaw is 0. // If Pitched, when Yawing correct the Roll to the same degree. // If Pitched, reduce the Yaw from the Roll to flatness. // let testRotation = camera.rotation.y() // let rx = testRotation.x; // let ry = testRotation.y; // let flat = Math.PI; // if (Math.PI % camera.rotation.x !== 0) { // y + z = flat // z = flat - y // + tracked roll // x = 1.5707963267948966 (Math.PI / 180) * 90 90° // y = 0.017453292519943295 (Math.PI / 180) * 1 1° z = 1° // y = 1.5707963267948966 (Math.PI / 180) * 90 90° z = 0° // testRotation.z = Math.abs(flat % ry) + this._trackRoll; // let delta = Math.abs(camera.rotation.z - testRotation.z); // Apply change in Radians to vector Angle. rotationChange = BABYLON.Quaternion.RotationAxis(BABYLON.Axis.Z, Math.PI % x); // Apply Roll to quaternion. currentRotation.multiplyInPlace(rotationChange); // } } // Apply rotationQuaternion to Euler camera.rotation. currentRotation.toEulerAnglesToRef(camera.rotation); }
  10. I'll mark this topic as solved, and direct any followup to the other topic, which builds on this. 👌
  11. PHEW Yikes. Your Imagine example is excellent! I've had trouble struggling to comprehend this issue in 3D rotations. Look up. Immediately look left. Yup, no roll but looks like a roll. Okay, so the FlyCamera needs to mimic how humans maintain global Roll, when looking around. No Roll unless Rolled.
  12. Hah, already responded to you on the 3D Camera topic, as well. The goal isn't a locked camera. So no locking any axis. And why do you get a roll from doing yaw and pitch? I can take an object and apply yaw and pitch without it rolling.
  13. "Loses the straight angle" means it has an unwanted roll. Why do you get a roll from yaw and pitch? You can take an object and yaw and pitch it without any roll.
  14. [Link removed. FlyCamera is now available in BJS for experimenting.] So, I've setup the new FlyCamera. I've put in two suggested methods of rotating and started testing. The first, which takes from the engine, seems broken. No Roll, and after turning around and over, the mouse movement is reversed. The second, inspired from the engine and taken from forum user coolroar mostly works, but suffers from a mysterious bug where moving the camera in a circle will slowly Roll it. I brought the whole experiment online and put overrides so it's testable and editable from my playground. 🙂 Feel free to play with it. Any ideas for why these bugs occur, and how we can achieve a non-buggy FlyCamera? I'm pretty lost.
  15. Wow, that's a cool visualization in that gif! 🤩