Dad72

Create ramp for ground

Recommended Posts

On 3-12-2016 at 10:31 PM, Dad72 said:

If there is one manners more general, I definitely want to see it. :)

There is, and it is by pulling the ground over a mesh. So you would create a ramp mesh (ground), and then pull the ground over it. It works better than the old code, and you can do much more with it as well. Here it is:

http://www.babylonjs-playground.com/#GQ83J#3

The brush size is now in BJS units. I also added some example shapes you can uncomment.
I like how elegant the new addRamp function has become :)

Edit: I fixed a wrong ray length in the code, added a new option to not let the ground go lower (allows ramps to go through each other), and corrected the comments:

http://www.babylonjs-playground.com/#GQ83J#4

Edited by Gijs
Fixed ray length code, added feature, corrected comments

Share this post


Link to post
Share on other sites

Hi @Gijs,

I'm coming back to you because you're the author of this feature that worked well before. But now, there is something different depending on the click and I do not know why.

I told myself that you can understand better than me what happens. Try this PG to create multiple ramps in multiple directions. they are not placing correctly.

I also noticed that if the terrain is not subdivided enough, it does not create flat ramps anymore. and if on a ground of 500 * 500 subdivisions of 500 are made that ground lose a lot of performance. And the bigger the terrain, the narrower the radius of the ramp (it would take a multiplier ratio, I guess, depending on the size of the terrain)

The ideal would be to subdivide only the part of the ramp. You think it's possible?

Thank you for your help.

http://www.babylonjs-playground.com/#GQ83J#9

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.