- Home /
Isometric character collision
I'm prototyping a base mechanic of a 3/4 isometric environment with click-to-move character movement (i.e. Diablo). I've got the barebones of it working and I'm trying to figure out the collision with environmental objects. At the moment I'm using Vector3.MoveTowards to move my character, so collision with objects doesn't work as the character just passes straight through it (the collision works any other time, just not when I'm using Vector3.MoveTowards).
I saw some folks recommend using a character controller instead, which I tried, but the collision still doesn't work. I've also thought about using Unity's pathfinding to handle this (and also takes care of the A* pathfinding I'll need) but as my environments get big I don't want to constantly have to be "baking" the collision mesh with every tiny change I make.
Any recommendations for a better direction to go with this? Is there a different method of moving my character that will result in collisions working correctly?
if you are going to have path-finding, do you even need collisions. Normally the path given will never walk into an obstacle anyway, that's sort of the point of pathfinding! :D
Collision does work with a characterController, if you move the way it wants, using charController.$$anonymous$$ove.
$$anonymous$$oving by directly changing position ($$anonymous$$oveTowards, translate) will always ignore collisions, no matter if you have a charControllor or rigidbody (a rigidbody often says "why am I slightly in a wall!!," and pops itself out. But a lucky $$anonymous$$oveTowards can still drive it through a wall.)
I hadn't thought about that. Good point. I had been considering these separate necessary systems. I suppose I'll just move forward with pathfinding. Thanks!
I would mark Scribe's comment as the best answer, but it's not letting me. :(
Answer by Anxo · Jan 08, 2015 at 04:27 PM
if you have a rigidbody on your character, you can use rigidbody.velocity to control your character's direction while respecting collisions.
Your answer
Follow this Question
Related Questions
How do I make objects disappear as they are touched? 1 Answer
How to make whole navmesh agent avoid carves rather then center of it? 0 Answers
2D Isometric Rigid Body Collision Resolution (collide and side) Not working 0 Answers
Have falling object exit from a collider after collision? 2 Answers
Ideas on pathfinding and collisions 0 Answers