Jump to content

Free camera to walk on steps


Vijay Kumar
 Share

Recommended Posts

Hi Vijay,

there are a lot of demos online, Espillit (http://www.babylonjs.com/Demos/Espilit/) would be my favorite.

If you want to share some code and show if something doesn't work, please do. Use the internal collisions system (here is a guide to get you started - http://doc.babylonjs.com/tutorials/09._Cameras,_Mesh_Collisions_and_Gravity)

Enjoy!

Link to comment
Share on other sites

Hi Vijay - welcome to the community :)

I created an example of climbing stairs for the "October Challenge" - creating a maze.

Here is the link Maze

The first part is an intro - let it play through and it will eventually drop you in a maze. You can open the gate by clicking on the lever - and walk up the stairs.

The code you need is in the file draw.js which you can see in the web console in Firefox. In that file is a function - function drawStairs(...) { ....}

Basically it creates a invisible slanted plane that you walk on but you see a staircase exactly where the plane is but that is collision disabled. The function actually creates four of them as well as the gates. And gravity has to be adjusted so that you can proceed up the plane. So for creating four sets of steps I use instances as the stair meshes are all the same and it allows for mesh efficiency.  

Try it - see if it helps. I have another example somewhere - but I have to find it - which I created a while back when I first tackled this same problem.

cheers, gryff :)

 

Link to comment
Share on other sites

Hi Gryff,

Thanks for the response.

Friend i am facing issue in that demo ,

Not able to click the lever and mouse functions like rotation are also not working.i can only walk in that demo not able to rotate with mouse movements also.

i have a doubt ,i am going through the tutorial (https://blogs.msdn.microsoft.com/davrous/2014/11/18/understanding-collisions-physics-by-building-a-cool-webgl-babylon-js-demo-with-oimo-js/)    , i downloaded the visual studio solution also.

i gone through main.js script there they just exported the scene but there also i didn't find anything related to camera walk on stairs.

could anybody help me how that walking on  stairs is working in that  ESpilit project

is there any code written in any other file or by using any existing methods in freecamera it is able to walk on stairs.

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