Recommended Posts

        :)  Are you talking about MY playing with applyDisplaceMapFromBuffer?  The "buffer" is just a pile of data... you could fill it dynamically or however.  I stole that func from BabylonJS heightMap/displaceMap features.  Both need to start with a 2D image, gathered from a context2D canvas.  In the jack-o-lantern demo, we see it happening at lines 22-47.  Line 46 is the lovely buffer-maker, grabbing the image data from the context2D canvas that was created in line 24.

Buffer is just a storage tank, for a pile of data.  Color data, I believe.  :)

Glad that you found playground search.  It works pretty well.  It doesn't enjoy periods in its search terms.  ie. someobj.propname.  Perhaps that has been improved since I last checked.

Share this post


Link to post
Share on other sites

Thanks @Wingnut for you insightful examples. My game requires space travel as well and that is why I was using a sphere for my world,but in the end I decided that I would swap out a heightmap terrain fro sphere when at certain altitude. This makes the project a lot simpler. And thanks @jerome for the artillery code,I'll be sure to add the both of ye in the credits of the game for all your help.Just one more question though, I'm using scene.onPointerDown when doing picking.So how would I allow dragging of cursor and continuous mining of terrain? I don't want to have to keep clicking screen every time I want to mine a bit of the terrain.

Share this post


Link to post
Share on other sites

:)  TD, are you currently able to click on certain areas of terrain and have them height-reduce?  While looking at the terrain from any camera angle?  That's not very easy to do.  (selecting locations/regions on a heightMap while viewing from any camera angle).

One area of interest might be the ActionManager.  Check out its docs.

Scroll down to "Experimenting Actions" section, particularly the part about chaining actions.

You could easily do something like...

- first click turns-on auto-pointer-mining (just rub pointer/crosshairs over terrain to drill)

- second click turns it off.

Aside: We have a Decal feature that places another image atop bumpy heightMaps, and it tracks up and down the sides of hills and valleys nicely.  It could be a "reticle" decal... for user selecting where to mine.  *shrug*

Back to cool ActionManagers: It is likely that your two actions would both be executeCodeActions.  First click... runs one function.  Second click... runs another func.  Maybe that will help.  Scene.onPointerDown is fun, but terrain.onPickTrigger (via terrain.actionManager) is even coooooler.  :)  Even the Scene object can have an .actionManager added, but I'm not sure when/why that is used.

On another sub-topic... you switch from bumpy-sphere to heightMap when the user gets near the planet surface.  You could also switch to "mineHeightMap" when user gets closer to the mine.  We talked about this before... somehow blocking the user from seeing the planet-sized terrain during mining (because you removed it and put a high-rez but smaller area mining terrain in its place.)

Maybe you could erect a dome over the mine... before they start work (a weather control dome).  That would block their view of the missing planet terrain and make them focus only upon the under-the-dome hi-rez mining terrain.  Then, I'd say... make the user click a thousand times to get to that ore deposit... just like a real mine.  Shovel and shovel and shovel-away that high-resolution mineMap... making tiny progress per shovel-full.  By the time they get-to that ore deposit, they have worn out their mouse/pad buttons.  :D  Make it miserable, just like real mining.  heh 

Just some thoughts. Pretty lame ones.  Domes don't sit on the sides of hills very well, when mining is needed there.  :(  Maybe have to surround the mine with fog, or crank-down the camera maxZ... so they don't see that you have removed setEnabled(false) the big chunky terrain, and added setEnabled(true) the fine-detail mining terrain.  (I'm obsessed with this mining terrain thing, eh?)  :)  Hey, its subdividing, but done with trickery and slight-of-hand... not on-the-fly Catmull math.

Share this post


Link to post
Share on other sites

Thanks for that great post! I got continuous mining working using an ActionManager (OnPointerDown) and used setInterval and canceled interval OnPointerUp! It need a good deal of work because mining can be inefficient when I use 500 subdivisions but the basics are there. Oh and scene action manager is used for key events apparently according the the documentation.I'll upload demo to my website later this evening.

Share this post


Link to post
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...

  • Recently Browsing   0 members

    No registered users viewing this page.