x


2D Game Colliding with wall

Hi, I'm currently working on a 2D platformer and I want to hit a wall and stop. I have a box collier characther controller, and rigid body active on the player. On the wall I have a box collider and a rigidbody. For some reason my character walks straight through the wall without stopping.

more ▼

asked Mar 22 '12 at 12:00 AM

8BitRain gravatar image

8BitRain
1 1 1 1

(comments are locked)
10|3000 characters needed characters left

2 answers: sort newest

Thank you for the help but I went back and found out what to do in my specific circumstance. I had to access the colliders and make checks against objects that I wanted to inhibit player movement. Thank you!

more ▼

answered Mar 23 '12 at 01:37 AM

8BitRain gravatar image

8BitRain
1 1 1 1

(comments are locked)
10|3000 characters needed characters left

You probably don't need to have a rigidbody on those objects. Rigidbodies are meant for dynamic physics objects that react to forces in the environment. Unless your wall is destructible, you probably don't want a rigidbody on it. Also, you generally want to be using either a CharacterController or a Rigidbody, not both. A CharacterController, in a lot of ways, is a replacement for an accurate physics object to make controlling a character feel right.

You could have a character controller by Rigidbody, but that is harder to get to feel right, especially if you are doing a 3rd/1st person type of game with a humanoid character.

There is more complete documentation here: http://unity3d.com/support/documentation/Components/class-CharacterController.html.

more ▼

answered Mar 22 '12 at 01:43 AM

kromenak gravatar image

kromenak
1.6k 23 29 41

(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:

x2497
x1037

asked: Mar 22 '12 at 12:00 AM

Seen: 680 times

Last Updated: Mar 23 '12 at 01:37 AM