Jump to content

Opposite event of onColide

Joshua Red

Recommended Posts

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?


Link to comment
Share on other sites

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.

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