avoba Posted April 27, 2017 Share Posted April 27, 2017 Hi! I'm using the right click to move the camera around, but I wanted to limit that movement/panning/translation. For exemple, when the camera/object/mouse hits the margin of the screen, it "kind of" locks it, and doesn't allow the objects in the scene to get out of sight. http://www.babylonjs-playground.com/#0XK6K2 by the way, for some reason I can't use use the right click in the playground... Thanks! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 27, 2017 Share Posted April 27, 2017 Hey are you developing the panning support or are you using the one included in the ArcRotateCamera? avoba 1 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted April 27, 2017 Share Posted April 27, 2017 Hi @avoba I have no solution to the isInFrustum (hint hint) issue, yet... but here is a playground demo where actionManager onRightClickTrigger was used. Right click on a mesh, opens menu. right click again to close. I'll need to think about rightButtonHeld trigger/event... a bit. We'll talk. Delta is stalking me today. Hi DK! Hope you're well. avoba 1 Quote Link to comment Share on other sites More sharing options...
avoba Posted April 27, 2017 Author Share Posted April 27, 2017 Hi @Deltakosh! I'm actually using the one included in the ArcRotateCamera. I can translate the camera without any problems, but sometimes when I move the mouse too fast, or to far, the object gets out of the screen... Thanks Also, thanks @Wingnut Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted April 27, 2017 Share Posted April 27, 2017 You will then have to test position of your camera on every frame and constraint it to the range you want. Just use scene.registerAfterRender(function(){}) to do that Quote Link to comment Share on other sites More sharing options...
avoba Posted April 28, 2017 Author Share Posted April 28, 2017 I wouldn't even know how to begin that! Newbie here... Quote Link to comment Share on other sites More sharing options...
Wingnut Posted April 28, 2017 Share Posted April 28, 2017 Hi guys. I built a playground scene (something I love)... where I try to activate a camera right-click-drag limiter. But I am having a stupidity problem with a seemingly simple thing - getting the right-button-drag to start working again... AFTER it has hit a limit. I can't seem to get my previousTargetScreenOffset variable in line 94... to be < 35 (watch console). 35 is the current range setting. When I get console ptso <35 (or > -35)... THEN I can re-activate line 96, and right-click-drag camera will not get "stuck" at limit location. Help! (I'm sure failing-at MANY playgrounds, lately) (I'm a bad coder, and proud of it. Hey, somebody has to suck, right? It's a dirty job, but, I don't mind doing the duty.) Avoba... this is a non-render-loop solution attempt. There is renderLoop code here... in lines 112-114, if you want to experiment-with Deltakosh-suggested ideas. I just thought I would TRY an onPointerMove solution, for test. I got spanked and served. heh Hope this helps something. Fixes wholeheartedly welcomed. GameMonetize 1 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.