Jump to content

Limit Camera movement while using right click


avoba
 Share

Recommended Posts

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!

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!  :D  (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.

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...