Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by darthbator · Oct 18, 2013 at 06:44 PM · 2dcollisionrigidbodycollidertranslate

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?

Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Fattie · Oct 18, 2013 at 06:56 PM 0
Share

you just use 2DToolkit, get it on the asset store. it's almost essential for Unity

(Unity are releasing "Unity2D" maybe next year.)

avatar image darthbator · Oct 18, 2013 at 07:54 PM 0
Share

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.

avatar image Fattie · Oct 18, 2013 at 08:02 PM 0
Share

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!

1 Reply

· Add your reply
  • Sort: 
avatar image
0

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

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

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

Answers Answers and Comments

15 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges