Zephos Posted October 20, 2018 Share Posted October 20, 2018 Hi all, I have been having loads of fun with the new gizmos, but I discovered something very interesting. The position gizmo scales with distance from the camera, but that mechanism breaks when the camera has a parent it seems. I think it must be using the local position instead of the global position. Here is the PG: https://www.babylonjs-playground.com/#31M2AP#35 Just press any key to move the camera's parent and see how the gizmo fails to scale properly, and if you move it around it scale erratically. Also, if you start the camera with a different position vector it effects the scale too, to the point where a vector of 0,0,0 makes it disappear. Anyway, please let me know if this isn't a bug or if there is a work around. Thanks! Quote Link to comment Share on other sites More sharing options...
ssaket Posted October 20, 2018 Share Posted October 20, 2018 Thanks yeah.. ! Happens more frequently when you do a jerk motion, though not sure about the scaling, I found it helpful when it scales bigger than sphere for distant 'z' positions, kindda gives me option to roll back. Quote Link to comment Share on other sites More sharing options...
Zephos Posted October 20, 2018 Author Share Posted October 20, 2018 4 minutes ago, ssaket said: Thanks yeah.. ! Happens more frequently when you do a jerk motion, though not sure about the scaling, I found it helpful when it scales bigger than sphere for distant 'z' positions, kindda gives me option to roll back. Hmm... I don't notice any difference when I do jerk movements. As you move the camera back, the gizmo axis should stay the same size in the view though, but they are not. That is the issue I was talking about. Quote Link to comment Share on other sites More sharing options...
JohnK Posted October 20, 2018 Share Posted October 20, 2018 Don't know anything about gizmos or how they work but setting a parent to the camera definitely affects how they behave. Here is a PG with parent to camera removed and the camera position changed directly https://www.babylonjs-playground.com/#31M2AP#36 When you use the console to log camera.position - in your version (#35) camera.position always logs the same value as it is set relative to parent. In my version (#36) the z value increments with the camera. So it seems that the gizmo manager uses the value given by camera position in its calculations whereas the rendering process takes into account the actual world position of the camera. Quote Link to comment Share on other sites More sharing options...
Zephos Posted October 21, 2018 Author Share Posted October 21, 2018 20 hours ago, JohnK said: Don't know anything about gizmos or how they work but setting a parent to the camera definitely affects how they behave. Here is a PG with parent to camera removed and the camera position changed directly https://www.babylonjs-playground.com/#31M2AP#36 When you use the console to log camera.position - in your version (#35) camera.position always logs the same value as it is set relative to parent. In my version (#36) the z value increments with the camera. So it seems that the gizmo manager uses the value given by camera position in its calculations whereas the rendering process takes into account the actual world position of the camera. I guess the question now is whether this is the desired behavior or not. I bet it's an easy fix if not, as you can just use the global position of the camera in place of the values its using. Hopefully we can get Deltakosh or someone else who can change the source code to see this and take a look. trevordev 1 Quote Link to comment Share on other sites More sharing options...
Gijs Posted October 21, 2018 Share Posted October 21, 2018 Pinging @trevordev Quote Link to comment Share on other sites More sharing options...
trevordev Posted October 22, 2018 Share Posted October 22, 2018 Yep, it was using position instead of global position, thanks for finding this. Created PR here with the fix. https://github.com/BabylonJS/Babylon.js/pull/5398 Quote Link to comment Share on other sites More sharing options...
Zephos Posted October 22, 2018 Author Share Posted October 22, 2018 3 hours ago, trevordev said: Yep, it was using position instead of global position, thanks for finding this. Created PR here with the fix. https://github.com/BabylonJS/Babylon.js/pull/5398 Awesome. Are you the original creator of the gizmos? They are pretty cool so thanks! I am using them for a major part of my game's interaction. Quote Link to comment Share on other sites More sharing options...
trevordev Posted October 22, 2018 Share Posted October 22, 2018 Yes, glad you are liking them ?! GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Zephos Posted October 24, 2018 Author Share Posted October 24, 2018 So how do I get the fix? I installed babylon using npm. Do I just need to wait for the next release? Quote Link to comment Share on other sites More sharing options...
Guest Posted October 24, 2018 Share Posted October 24, 2018 Yes (unless you want to use our CDN version?). Next NPM update will be this friday Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.