Jump to content

Extruded shape stairs doesn't work as stairs


Recommended Posts

I've created a stairs from BABYLON.MeshBuilder.ExtrudeShape, but is doesn't work. I start to drown into mesh after reaching the top of the first step.

However, stairs from regular boxes works well.

You can check them both at my playground: https://www.babylonjs-playground.com/#PVAC9F

Also, I have to say, that stairs from ExtrudeShape doesn't look good. Look at theese side caps.

Also I have trouble with positioning. Changing the third parameter of createStairs function doesn't affect where stairs appears. I have to change position by position property of mesh after creation (I do this inside function at this moment).


Link to comment
Share on other sites

:)  Hi guys.  @JohnK, ya "bought the farm" on this one, eh?  ;)


Just another.  I lined up the camera, put it in the air and set _needMoveForGravity = true;

Then added my flaky .showEllipsoid func, and went to work in 138-140, putting the collider in the center of the first step as best i could.

That's not going to work, though.  Not only do we need a collider on every step, but as long as camera.applyGravity is ON, the camera will not climb-over the collider.  It keeps sliding-off the collider backwards, because the camera gravity won't let it climb over. 

WE got trouble.  BIG BIG trouble.  :o   :)   Ok, not that much trouble, but some.  I don't think extruded stairs will ever be collider-climbable... not without some serious hackus big mackus.  Thinkin'.

Link to comment
Share on other sites

Oh, Naz is on-forum ( @NasimiAsl )... he built a big shopping center with long, climbable stairs.

http://melyon.ir/   (slow loader, but gorgeous).  Enter tallest building.  Many stairs inside.   I don't think camera gravity is active AT ALL in Melyon.  Perhaps terrain-following, though, and that might be the same system that climbs the stairs.   Thoughts, Naz? 

Maybe he used invisible mesh parented to camera(low height), and when mesh intersects next step, he lifts camera/player one step-height (probably with NO camera gravity active... when player/camera is upon stairs).   I guess that IS basic "feel-with-a-stick" terrain-sensing, eh? 

Need picking-ray or bounding box intersects... something like that.  More thinkin'.  :)

Link to comment
Share on other sites

Well, I decided to choose an easy way and just to create stairs from merged boxes.


It fits what I need. Hope, it also will be useful for other developers.

Just one notice. It starts to work glitchy with low width of the step (parameter w). So I don't recommend to use values lower than 0.5.

Link to comment
Share on other sites

Oh Splash, that is MARVELOUS!  I LOVE how the far horizon bounces with each step taken.  And I like how reversing direction on the stairs... works perfectly.

Good good good.  Yes, this will be useful for others.... definitely.  Nicely done!  Thanks for sharing!   I can't believe how well the collisions work on that thing.  Just... sweet.

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.

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.


  • Recently Browsing   0 members

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