How do I make my entity not "climbable"?

I have a part of a game where there are walls and no roof, but you can climb the walls, the walls are pipes and there are ridges. I am trying to make the walls not climbable.

By climbable I mean if I walk into it and jump I go up it, Evan after jump height.

You need to modify the rigidbody settings (friction and damping) of the wall and maybe the player.

I made the walls more, I just haven’t tried the player.

More what?

Modifying the rigidbody of the player has also consequences for movement.

I tried the players rigidbody and there was no effect besides a little resistance on climbing. Nothing on movement

By I made the walls more means I increased the rigid body settings

Also the player is dynamic and the walls are static

If you share a link of your project I can take a look.

PlayCanvas | HTML5 Game Engine you can go forward through the spinning danger sign and walk into the pipes and jump It will go up a bit, not as bad as before

The problem is different than I thought.

Your jump logic ensures that you can jump again when you hit the obstacles with the side of the player.

You can give the obstacles a tag and ignore collision with the obstacles in your jump script.

image

Jump.prototype.onCollisionStart = function(result) { 
    if (result.other.rigidbody && !result.other.tags.has('obstacle')) { 
        this.canJump = true;
    }
};

I used your code and rebuilt the jump script, also modified your part a bit and got this:

/* https://forum.playcanvas.com/t/help-please-i-need-a-jump-feature/15408/28
Where The Jump Code Comes From!!!
*/
var Jump = pc.createScript('Jump');
var canJump = false;

Jump.prototype.onCollisionStart = function(result) { 
    if (result.other.rigidbody && !result.other.tags.has('obstacle')) { 
        this.canJump = true;
    }
    else (canJump = false);
};
Jump.prototype.update = function(dt) {
if(this.app.keyboard.isPressed(pc.KEY_SPACE)){
if(this.canJump == true){
this.entity.applyImpulse(0,0,5);  
}
};
};

No errors but I cant jump, any ideas?

Not sure why you changed the whole script so it doesn’t work anymore?

Do you have any problem if the script is like below?

var Jump = pc.createScript('Jump'); 

Jump.prototype.initialize = function() { 
    this.canJump = true; 
    this.entity.collision.on("collisionstart", this.onCollisionStart, this);
    this.entity.collision.on("collisionend", this.onCollisionEnd, this); 
}; 

Jump.prototype.onCollisionStart = function(result) { 
    if (result.other.rigidbody && !result.other.tags.has('obstacle')) {
        this.canJump = true;
    }
};

Jump.prototype.onCollisionEnd = function() {
    this.canJump = false; 
};

Jump.prototype.update = function(dt) { 
    if (this.app.keyboard.isPressed(32) && this.canJump === true) { 
        this.entity.rigidbody.applyImpulse(0, 350 ,0); 
    } 
};

I remade the script because I couldn’t find where your code would fit in, also it was complex and could be simpler. Also, the script works. Thanks :smiley:

The code is good, but after touching a wall I cant jump for a couple of seconds, any ideas?

I have made a Basic Jumping example project, where I use a raycast to detect the ground instead of collision. This will probably solve all the problems of this topic. Please let me know if this works for you.

https://playcanvas.com/project/1063800/overview/basic-jumping

1 Like

It doesn’t work, no jump, I tried increasing both jump force and sensor length

Nevermind, It actually jumps, I am going to test it on the walls now.

You can still climb the walls but it is harder to do so, so thanks! I think this is good! Thanks again for all your help :smiley: