- Home /
Need advice for 2d physic decision
Hi all
I'm new to unity and just worked some 2d tutorials through. now I'm trying to start my own 2d game and don't know which way of "physic implementation" i should chose. As I see there are two obvious ways:
use unitys physic with gravity, colliders, character controller, rigibodies and so on.
implement it by my self, even "colliders" with raycasting almost everything.
As I can see in other answers, there is no obvious right way. But each has his advantages and disadvantages. E.g. first way is a lot easier to start with and you need to script less. But at some point I'm struggling with strange 2d behaviour like screenshot 1.

now before i'm starting chosing way 2 and implementing everything by my self I ask you for advice :)
thank you very much!
If you character is rectangle and you want it to collide with objects, but a box collider on it ins$$anonymous$$d of a capsule.
yeah right, but the box collider replaces my character controller, so i'm losing all his features and "good" parts :(
when you refer to strange 2d behavior you mean that your character overlaps the collider?
not the overlapping. he is "hanging" there, because the character controller collider isn't a rectangle :/ and as far as I know I have to replace it with a box collider to get a rectangle.
Yes I agree with what was said before (to use a box collider) although you would have to write your own character controller which is the best way to go, but as you said you don't have any of the pre defined stuff. There is no way either to just replace the capsule collider with a box collider without rewriting at least half the thing, the scripts calculate many values based on a capsule shape.
But a workaround that comes to my $$anonymous$$d is to change the "Radius", "Height" and "Center" of the Capsule to suit your needs more accurately. You could have these values code driven. Do a pre check of where your character is going and where the closest collider of your environment is, find out where he should collide and shift your capsule via code.
Let me know if I made it clear :)
Answer by sspross · Nov 12, 2013 at 03:18 PM
thanks to the discussion in the comments above, I decided to chose the second way and get rid of the character controller and implement it by my self. thanks to all the commenters! I will mark this question as answered to keep unity answers clean if nobody else disagree :)
Your answer