Jump to content

Character controller problems


Genebris
 Share

Recommended Posts

I'm making platformer and I have two problems with character controller and SetInput.

 

1: When walking on the ground movement speed changes instantly, but when in midair it changes very slow. I need my character to instantly change direction while in midair.

 

2: Jumping applies force instead of instantly changing speed. Again, I need this to be instant.

 

There wouldn't be problems if SetVelocity worked on character controller, but it doesn't.

 

I can't use rigid body because it bounces on collisions and there doesn't seem to be a way to disable that.

Link to comment
Share on other sites

The tradeoffs are inevitable and this is why I coded my own in my last tournament entry. Not to say that there aren't solutions to your problems but I don't know any.

 

That said, I thought SetVelocity did work on character controllers. I could have sworn I used it to push back enemies in the past when they were hit.

 

Edit: it was probably AddForce.

Link to comment
Share on other sites

#1 is a design decision. If you would like this to be changed I can consider it.

I understand that it's more realistic, but there should be a way to work around that. Like another maxacceleration parameter.

 

 

#2 is diffuicult to judge. How else would this work? What exactly are you describing?

Have you played Volgarr the Viking? This is what I'm trying to make. In this game you can't control character in the air, but you instantly change speed when using double jump. This includes horizontal and vertical speed. If you are falling down for a few seconds you gain speed, but when you use second jump you instantly get positive vertical speed which wouldn't happen with simple AddForce. Same for horizontal speed.

 

It's like calling SetVelocity(0,10,0) the first frame user presses a button, but then letting physics engine to calculate everything.

 

 

I have recorded a short clip to show this

 

 

Basically, I could use SetVelocity for both, but it doesn't work with character controller. Can you make it work with it?

 

 

The tradeoffs are inevitable and this is why I coded my own in my last tournament entry. Not to say that there aren't solutions to your problems but I don't know any.

 

That said, I thought SetVelocity did work on character controllers. I could have sworn I used it to push back enemies in the past when they were hit.

 

Edit: it was probably AddForce.

Pretty sure it was AddForce, SetVelocity isn't working for me right now. Did you use rigid body in your game? What did you do with bouncing? I can't launch your game because it starts with too high resolution for my monitor.

Link to comment
Share on other sites

Did you use rigid body in your game? What did you do with bouncing?

For my 2D platformer (Run! Jump! Climb!) I coded my own from scratch. For the other one I used the character controller.

 

I can't launch your game because it starts with too high resolution for my monitor.

I was afraid this would happen. The game gets information from your system and takes the last (ideal) value. But I guess it doesn't work for everyone. :(

Link to comment
Share on other sites

That totally makes sense. I can add a damping parameter to use when the character is in the air, and in your case you would set it to 1.0 for no damping. Presently this is hard-coded at 0.25.

  • Upvote 2

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

  • 2 weeks later...

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