- Home /
Dealing with 2D movement and collisions!
So I've recently started making my first actual 2D game in Unity!!! Unfortunately this has been much more difficult then I initially thought it would be! This is really a question of how to deal with movement and collision in 2d. I've been using 2dtoolkit to get my sprites atlas'ed and animated thusfar and have gotten them moving around. That's when I started running into some issues.
First off I don't want to use a character controller. It's capsule shape does not seem well suited for a 2d platformer. So I decided to try and work with raycasts and standard colliders. This also proved to be challenging.
More recently I've tried placing kinematic rigidbodies and triggers on all of my "actor" objects and then move them by using ridgidbody.movePosition. This does seem to generate messages when bodies overlap. It also seems that raycasts are able to strike the trigger/collider when I am moving via the rigidboby component but not when I am Translating a n object.
I guess what I'm really asking here is, is there a generally accepted "best practice" way of doing this? Am I heading down a/the correct path?
you just use 2DToolkit, get it on the asset store. it's almost essential for Unity
(Unity are releasing "Unity2D" maybe next year.)
Ummmmm... I am using 2d toolkit. How does that somehow magically solve my collider issues? I still need to figure out how to deal with collisions in my game environment. I still need to move objects around and detect when they are touching other objects.
sorry, you know how it is on a forum, it's impossible to know where others are at. (nobody ever understands my questions :) )
Can you outline the nature of your game, where are the layers? So for example i usually have the camera at 0,0,0 and the various layers at say 5m, 6m, 7m, 8m and so on. So it might be that the hero is at 7m, the bullets are at 6m, the clouds at 11m and so on.
Is this basically what you're doing? Please outline! Include a photo!
Answer by Fattie · Oct 18, 2013 at 08:02 PM
Is it possible this is could help? I'm not sure precisely what U need but try this
http://answers.unity3d.com/questions/307540/is-it-possible-to-cast-a-ray-but-ignore-z-position.html
Your answer
Follow this Question
Related Questions
GameObject ignores collision while swinging from hinge joint 2D 4 Answers
Collider2D.IsTouchingLayers() delayed reaction 1 Answer
Collider2D/RigidBody2D not working 1 Answer
Ignore collision at high velocity. 1 Answer
Colliders in a wall jut out 0 Answers