x


Should my character controller slide down a ramp when I apply gravity to it?

Because that's what I currently want to achieve, but I don't want to use rigidbodies because I need to have more control over physics. My character controller is on a down ramp but it's not sliding down. Is there a way to do that without using rigidbody?

Thanks

more ▼

asked Jul 25 '11 at 02:45 PM

nkr gravatar image

nkr
1 2 2 2

the character controller doesn't use real physics. In order to use real gravity, you'll have to make a rigidbody somewhere :/ I think you might have to choose between rigging a physical controller or rigging an artificial ramp slide. If its not going to be frequent, the ramp slide will likely be your best bet, since then you don't have to tweak the natural feel of the character movement.

Jul 25 '11 at 04:43 PM Alec Slayden

I guess i'll have to use a rigidbody for it.. But I've gotta find a way to better control the effect of physics on my object.

Jul 25 '11 at 05:02 PM nkr

Controlling physics is still very possible even when using a Rigidbody. If all you want is for the rigidbody to not fall over, simply lock its rotation.

Jul 25 '11 at 06:31 PM Jason B

And I also want it to "glue" on some objects.. but I think thats another matter.

Jul 25 '11 at 06:34 PM nkr

Could also be done very simply. If you want the rigidbody to be stuck and not move, simply set its isKinematic value to true and parent it to whatever it's stuck on. There's really nothing a CharacterController can do that a rigidbody can't do better in my experience. Feel free to ask more questions another time if you need help using a rigidbody.

Jul 25 '11 at 06:36 PM Jason B
(comments are locked)
10|3000 characters needed characters left

1 answer: sort newest

I don't konw what the other guys who are commenting on your question are on about- you do NOT have to use rigid body simulations. In fact, unless you want your character to have physics applied all the time, it's pretty much a waste of time and processing power.

Adding slide velocity is just as easy as making a 'jump' work. All you have to do is apply downward velocity for gravity and forward velocity in the direction the slope would have you slide. It really is that simple... I'm not sure why so many things get overcomplicated.

For example- in super mario world, you could slide down hills. do you think they used physics simulations for that? I don't think so :)

more ▼

answered Jul 25 '11 at 06:41 PM

testure gravatar image

testure
4.2k 20 25 48

Yea but I think it's a good idea to use rigidbodies in my game, because it is kind of a physics game.

Jul 25 '11 at 06:45 PM nkr

There's a lot more code involved with getting a CharacterController to work just the way you want it. Not to mention, CharacterControllers have a few show-stopping bugs attributed with them (especially when you want to make your character jump). The reason I recommend using a rigidbody is because it requires ten times less effort for an equal or better result. The processing power is absolutely negligible, especially if you've locked its rotation, your iterations are low, and if it's only the player character that is using one. Also, nowhere did I say you HAVE to use a rigidbody. I was making a suggestion based on my personal experience that working with rigidbodies is a lot less fuss and a lot more function than using a CharacterController.

Jul 25 '11 at 06:53 PM Jason B

I respectfully disagree.. I find that 'tweaking' a character controller's behavior in a non-simulated environment is MUCH easier than applying a rigid body and hoping the physics look correct. In games that I have worked on, we've done both- and 'faking' gravity/slide velocity has always been the more controllable way of doing things.

I mean- RB's look great out of the box- but what happens when they don't behave exactly as you want? You have to start screwing around with adding forces or tweaking friction/bounce. If you just want a generic physical slide and don't really care how it looks or behaves, then I concede that it is much easier to slap one on there and forget about it.

But, I'm getting away from what the OP is asking- and based on his comment it seems like he's making a physics game, which would negate my point entirely.

carry on ;)

Jul 25 '11 at 07:15 PM testure

Dont worry, Im glad to read such great posts...this subject is very confusing and it seems that most new unity users such as myself get confused about it :)

Jul 25 '11 at 07:18 PM nkr
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1867
x1787
x670
x459
x22

asked: Jul 25 '11 at 02:45 PM

Seen: 1641 times

Last Updated: Jul 25 '11 at 07:18 PM