Jump to content

Character Controller Slows Down on Steep Slopes


 Share

Recommended Posts

I found that my character controller slows down drastically (almost to a complete stop sometimes - seems to be dependent on how fast I am moving) when moving on slopes above 30 degrees.

 

I understand the character controller can't move on slopes>=45 degrees but slowing down > 30 degrees seems like a major bug.

 

For example when moving down a steep slope I move slower!

 

I can provide more information/my project and could make a video showing the behavior if it's needed.

Link to comment
Share on other sites

  • 3 weeks later...

It should be possible to demonstrate this with just the FPS controller map, and it doesn't occur there.

 

Ok well I am testing it with the FPS controller terrain.map and some strange stuff is occuring.

 

Using the fpsplayer model gives me different results than using a pivot (which is what I am using in my game). While using a consistent set input speed value of 15 the fpsplayers z velocity is 600 while the pivots is 15.

 

I had to alter the terrain.map slightly to create a better testing area and found that I could recreate the slowing down issue on slopes>30 degrees when using both the fpsplayer model and the pivot as the character controller.

 

I'm trying to download the new version of obs and set it up right now to record a video to show you what's happening. Do you want the altered terrain.map and FPSplayer.lua I am using for testing?

 

edit- slowing down seems to actually become noticeable when the slope is >20 degrees

 

edit- video demonstration uploaded -

- beware headphone users happy.png -

Link to comment
Share on other sites

if self.entity:GetAirborne()==false then
if (speed>self.moveSpeed*0.5) then
local t = Time:GetCurrent()
local repeatdelay = self.footstepwalkdelay
if speed>self.moveSpeed * (1+(self.speedMultiplier-1)*0.5) then repeatdelay = self.footsteprundelay end
if t-self.lastfootsteptime>repeatdelay then
 self.lastfootsteptime = t
 local index = math.random(1,4)
 self.sound.footsteps.concrete.step[index]:Play()
end
end
end

 

thats because while moving down hill the character is actually in the air and falling, the function above only lets player move while on ground.

 

Well this happens when moving up hill as well so I'm pretty sure it has nothing at all to do with being airborne but go ahead and do some testing to prove me wrong if you want.

 

The code snippet you posted only affects the playing of footstep sounds when airborne so I'm not sure how that affects player movement.

Link to comment
Share on other sites

I don't see anything out of the ordinary here. The player cannot climb a slope steeper than 45 degrees, and it makes sense that it might slow down when going up a hill.

 

It can slow down when going down a slope, because the character is periodically "airborne" and has less traction for small moments of time.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Well slowing down to half of the speed you enter into SetInput shouldn't be ordinary because it ruins any game where movement speed is important.

 

When going down the slope I can confirm you slow down while not being airborne. So that doesn't really make any sense.

 

In my tournament game you are a snowboarder going down slopes and you slow down once the downhill slope gets >20 degrees. This ruins your momentum and it doesn't make any sense because you are going downhill. This specific bug (feature?) completely ruins my game.

 

Basically: Why is there some sort of invisible code forcing the player to slow down when slopes are above 20 degrees and can that be removed so that I can have more control over my game?

 

If not could these things at least be documented somewhere so that people don't have to go through all the frustration of figuring out why their character is slowing down for no reason?

Link to comment
Share on other sites

I don't think the character controller is appropriate for a snowboarding game. I wouldn't even attempt to use physics for such a thing, because the physics of snowboarding are really complex. I would probably do this with a pick command with a radius, and keeping track of velocity myself.

 

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

I don't think the character controller is appropriate for a snowboarding game. I wouldn't even attempt to use physics for such a thing, because the physics of snowboarding are really complex. I would probably do this with a pick command with a radius, and keeping track of velocity myself.

 

 

........ thanks. I have a pretty good set up and this is the one major issue holding back my game so you telling me to completely rethink my game because you are unwilling to address this issue (that affects more than just snowboarding games) is very disappointing. You didn't even attempt to answer my question -

 

Basically: Why is there some sort of invisible code forcing the player to slow down when slopes are above 20 degrees and can that be removed so that I can have more control over my game?

 

If not could these things at least be documented somewhere so that people don't have to go through all the frustration of figuring out why their character is slowing down for no reason?

Link to comment
Share on other sites

The character becomes airborne periodically when moving downhill because they move laterally faster than the gravity acceleration of -9.8 m/s^2 kicks in. Player movement itself is an unrealistic approximation of real physical movement of a person.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Alright so you don't want to do anything about this and are basically just saying this is intended. Close the bug report, it's done.

 

I think you will be surprised how well the character controller works in my snowboarding game (even with all these bugs) based on how impossible you think it is.

 

Also can you document this "feature" somewhere so people know what to expect?

Link to comment
Share on other sites

curious, ur making snowboard game. did you change physics config or something? friction? elasticity?

 

i use character controller in terrain many times, not got this problem ever. so problem likely on ur end.

 

Watch this:

Then read the response by Josh -

I don't see anything out of the ordinary here. The player cannot climb a slope steeper than 45 degrees, and it makes sense that it might slow down when going up a hill.

 

It can slow down when going down a slope, because the character is periodically "airborne" and has less traction for small moments of time.

 

You have this problem too, it's not on my end. Stop making baseless accusations.

Link to comment
Share on other sites

The player controller was never intended for making a snowboarding game, although that might be a good use if we can figure out a way to make it work. I have never heard of anyone using it in this manner until maybe an hour ago.

 

I have recently tried another approach to this, that never saw the light of day, but it was a failed attempt and I am working with the author of Newton physics to make something better. I don't know if this will solve your particular case, and I am not attempting to make anything except a basic character controller, but it is something I have been experimenting with:

http://newtondynamics.com/forum/viewtopic.php?f=9&t=9014

 

I can't really say anything more than that right now because I don't know what will actually work. I'd like to be able to provide more robust player physics, but I am still figuring out how.

 

I'd say just publish the game, with the understanding that it isn't going to be perfect in the time allotted, and maybe it is a new usage of the player physics I did not think of that can be incorporated into future development. The nature of the game tournament games is that titles will be unfinished, rough, but they get released.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

The player controller was never intended for making a snowboarding game, although that might be a good use if we can figure out a way to make it work. I have never heard of anyone using it in this manner until maybe an hour ago.

 

I have recently tried another approach to this, that never saw the light of day, but it was a failed attempt and I am working with the author of Newton physics to make something better. I don't know if this will solve your particular case, and I am not attempting to make anything except a basic character controller, but it is something I have been experimenting with:

http://newtondynamics.com/forum/viewtopic.php?f=9&t=9014

 

I can't really say anything more than that right now because I don't know what will actually work. I'd like to be able to provide more robust player physics, but I am still figuring out how.

 

I'd say just publish the game, with the understand it isn't going to be perfect in the time allotted, and maybe it is a new usage of the player physics I did not think of that can be incorporated into future development.

All I have to say is I am using very basic character controller commands to make an arcade snowboarding game. It is not ultra realistic, it is just jumping and moving around so it really shouldn't require some super complex character controller. I do hope to see improvements to this issue in the future since it affects literally every project using character controllers for movement.

 

The game will be published because it works pretty damn well even with all the issues. I should have it published later today or tomorrow.

 

i dun have the problem.

 

yes you do, go test it using the same script changes I did In the video I linked to you and you will get the same results. I doubt you will though, just seems like you want to be annoying.

Link to comment
Share on other sites

The problem is it was never anticipated that the user would want to slide down slopes at 40 MPH, as much as I enjoy doing so in real life.

 

a68d7e9a82504c5a432c2808d3743105.jpg

  • Upvote 1

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

u want snowboard slide effect u change friction, not movespeed. that cause issue. not engine fault.

 

too much movespeed u make player flying in the air. u not see this in ur example because it happen very quickly.

 

And that explains why it happens going uphill too right?

Link to comment
Share on other sites

And that explains why it happens going uphill too right?

I do not know. Snowboarding would be an extremely low-friction situation (if you have recently waxed your board) so you may be experiencing a situation no one else has dealt with or noticed. Climbing uphill slowly is a natural phenomenon, so even if it is so that is probably why no one has pointed it out until now.

 

yes, ur car at 80mph towards steep hill will not go up smoothly. pretty sure that.

A snowboard will.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

The difficult part is that a snowboard will stay upright with a competent rider, in situations that would flip a vehicle. So it really is a special problem that has characteristics of both.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Does it even pay to use physics? Just align the board to the terrain and move it without physics engine. Messing around with forces would probably result in clumsy controls for the player. In snowboarding games you don't normally fall when doing straight down, it's usually when doing tricks and not landing them right, which probably would suck and be less epic with real physics systems.

Link to comment
Share on other sites

Does it even pay to use physics? Just align the board to the terrain and move it without physics engine. Messing around with forces would probably result in clumsy controls for the player. In snowboarding games you don't normally fall when doing straight down, it's usually when doing tricks and not landing them right, which probably would suck and be less epic with real physics systems.

 

I have learned that I should probably use simulated physics for snowboarding games instead of actual physics and will do that in the future. I did use physics for collisions with vegetation and rocks to hurt the player but that could probably be simulated as welI. Also it was simply easier for me to just use the character controller and it's commands rather than creating my own new system due to the time constraint of the tournament.

 

I just thought that the character controller should move at a set consistent speed since there was no documentation saying otherwise. I believe that any slowing down on slopes should be handled by the user but am fine if this is the way it will stay. At least I know how it works now.

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.

 Share

×
×
  • Create New...