Im working on a 2d game, and came down to the point where i needed to detect collisions by direction, and that lead me to Character Controllers, after playing around a bit i discovered its not practical for my game for several reasons, especially since i rely on forces a lot and that requires a rigidbody, tried using both with disappointing results as they were not meant to be used simultaneously.
My questions is, is there anyway around this issue, such that i can detect collisions without relying in a CHaracter Controller?
Any feedback, suggestions, and obviously solutions are welcome.
For 2d I usually prefer character controllers, because they allow me to do a more manually movement that is more natural for 2d games (like mario or castlevania).
Rigid body is a nice solution but you depend on the physx engine and your tweeks.
If you have a problem with collisions or collision detection, maybe you are not setting the triggers well, or maybe you need some helper methods to work with your character controller
look at this c# extension that returns if the character controller is touching a wall for example
just like this you could find more helper methods for the character controllers.
Also remember that when using colliders the OnTriggerEnter will only dispath if one collider has its trigger false and the other collider has its trigger in true. (it doesnt matter if is rigid body or character controller)
player.collider | other.collider | OnTriggerEnter will dispacth
trigger=true | trigger=false | yes
trigger=false | trigger=false | no
trigger=true | trigger=true | no
trigger=false | trigger=true | yes
Thats all.
Thnx, for all your feedback guys been really helpful. That thread was some amazing piece of work. And after some thought, a character controller was an obviously better solution. Thnx again guys Cheers :)
Character controller should be used as long as you are trying stuff like mario. If you want to go for gravity things like walking on the walls and upside down on the ceiling then CC won't do as you cannot rotate the capsule (at least I have not managed) and then rigidbody comes to the rescue as you can do anything with it.
I guess my main question was misleading. My concern is the use of the collision flags such as above and below that are a part of the Character Controller, thats what im after really. Is there anyway to achieve that without a Character Controller? Thnx
Thnx, for all your feedback guys been really helpful. That thread was some amazing piece of work. And after some thought, a character controller was an obviously better solution. Thnx again guys Cheers :)
– H3coreCharacter controller should be used as long as you are trying stuff like mario. If you want to go for gravity things like walking on the walls and upside down on the ceiling then CC won't do as you cannot rotate the capsule (at least I have not managed) and then rigidbody comes to the rescue as you can do anything with it.
– fafase