Joshua Red Posted October 20, 2018 Share Posted October 20, 2018 Hi, I'm trying to make an FPS game, and right now I'm attempting to make climbing up ladders possible. What I've tried so far is to have an `onCollide` event move the camera up a bit, but gravity pushes it down again, so I disable gravity when you move up: camera.onCollide = function(collidedMesh) { if (collidedMesh.id === 'ladder') { camera.applyGravity = false; camera.position.y += 0.02; } }; But then I have to turn gravity on again afterward. So when it stops colliding I want to enable gravity again, but I can't find the right event to use. Do you guys know anything else I can try? Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted October 22, 2018 Share Posted October 22, 2018 camera.onCollide = function(collidedMesh) { if (collidedMesh.name == 'ladder') { camera.ellipsoid.y =0.5; } else{ camera.ellipsoid.y =0.2; } }; hi @Joshua Red welcome to forum if you explain why you wanna change camera may be i can help more https://www.babylonjs-playground.com/#A79EEE#2 Quote Link to comment Share on other sites More sharing options...
Joshua Red Posted October 23, 2018 Author Share Posted October 23, 2018 Hi NasimiAsl, thank you for your reply. What I was intending to do is if you're walking forward and you walk into a ladder then it would automatically start moving you up the ladder, like how ladders are in Minecraft. I could use your suggestion and transport them to the top instantly (or use a animation) but it would be nice if I could jump off the ladder half way. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.