Characters, Ramps, and Ladders

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
ntd master
Posts: 10
Joined: Wed Nov 24, 2010 9:29 pm
Location: United States
Contact:

Characters, Ramps, and Ladders

Post by ntd master »

Hey guys, I'm currently using the SimpleCharacterController from version 0.15.2 and I'm having an issue with some of my movement. Some of the buildings in my game have somewhat steep ramps or 90 degree ladders that I'd like the player to be able to climb at the same speed as the normal walking speed.

I've tried modifying some of the traction settings, and the MaxSlope setting for the ramps, but my character only can barely get up them if he has a decent amount of momentum first, and I'd like to just be able to casually walk up and down the ramps (say one that was 50 degrees as an example) without my speed increasing or decreasing. Is there a property that would enable this? Or is there something I need to disable to do this?

Also I was wondering if anyone had any suggestions on what kind of event collisions I should be using to simulate a basic 90 degree ladder. I'm thinking that if I had an event that turned off gravity for the player whenever they were touching the ladder that might essentially allow for the simple up and down movement I'm looking for but is there anything else that might be better?
Follow on Twitter: Vulture Games
Official Website: Vulture Games Studio, LLC
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Characters, Ramps, and Ladders

Post by Norbo »

Is there a property that would enable this? Or is there something I need to disable to do this?
The MaxSlope property should do the trick. It is in radians.

The SimpleCharacterController has another limitation when it comes to slopes. It's a raycast coming out of the bottom of a capsule. If the slope is steep enough that it hits the body of the capsule and the ray is left hanging, you won't be able to climb it. If this is happening, try increasing the maximum step height or reducing the radius. For reasonable step heights, this shouldn't be an issue until the slope is really steep.
Also I was wondering if anyone had any suggestions on what kind of event collisions I should be using to simulate a basic 90 degree ladder. I'm thinking that if I had an event that turned off gravity for the player whenever they were touching the ladder that might essentially allow for the simple up and down movement I'm looking for but is there anything else that might be better?
The basic idea is indeed to detect when you're interacting with a ladder and provide a different from of control. You could create a ladder volume entity which has collision rules set up such that it generates contacts, but does not solve them (CollisionRule.NoSolver). Using the collision events you can keep track of when it enters and exits the volume. When it's inside, you can switch to the other form of control. Alternatively, you can have other conditions, like you have to press 'use' while in the volume in order to climb it.

One simple kind of ladder behavior behavior is putting the character on a rail that it follows between endpoints from which it can dismount. Based on which direction the player is facing the character can go up or down along the ladder.
ntd master
Posts: 10
Joined: Wed Nov 24, 2010 9:29 pm
Location: United States
Contact:

Re: Characters, Ramps, and Ladders

Post by ntd master »

Thanks for the help. I'll have to take another look at MaxSlope, though by the sounds of it I might be having a problem with the raycast hanging...so I'll definitely have to check that.

Also the rail idea is curious and is something I'll definitely have to test out. Good stuff.
Follow on Twitter: Vulture Games
Official Website: Vulture Games Studio, LLC
Post Reply