Jump to content

Scrolling Behavior for WorldSpaceCanvas2D


NIK30
 Share

Recommended Posts

http://babylonjs-playground.com/#28LCTD#1

This demo has LOTS of code that was borrowed from DK's drag and drop playground demo.   Essentially, instead of using the normal getGroundPosition func, I converted it to getCanvMeshPosition.  After a bit more tweaking, we have successful dragging upon a canvas2D.  YAY!

But, the action being taken with each drag... is a camera.target move, not a canvas2D location move.  The drags are sliding-around the camera, not the blue rectangle. 

Seems to work.  I included a sensitivity setting, just cuzzz I'm a nice guy.  ;)  This should do what you want, no matter the zoom level.

Are you planning to fill the blue rectangle with a map/land-texture?  Is this for a "map view" of a game?  Coooool.  By the way, welcome... good to have you with us.  I hope this helps your issue.  If not, just say so, we'll try something else.  Party on!

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...