Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by Pnvanol · Mar 19, 2016 at 06:06 PM · collider2d

make 2 objects on 2d to collide with each other

Im just looking to get to 2d characters to avoid passing through each other , i tried adding rigidbody2d, box colliders ,but wasnt succesful.

I just want a normal collision like a 2d rpg ... but also I want the collision to trigger an event with ontriggerenter2D

thank you for the help

Comment
Add comment · Show 2
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 Ali-hatem · Mar 19, 2016 at 07:04 PM 0
Share

show us your code you might missed something & don't make the collider component is trigger because this is what "is trigger" about unless you code something when they collide & Ontriggerenter2D not ontriggerenter2D .

avatar image Pnvanol Ali-hatem · Mar 19, 2016 at 07:34 PM 0
Share

Thank you, now one of them get pushed when colliding with the player, I want it to stay static, any idea?

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Zoogyburger · Mar 19, 2016 at 07:09 PM

You need 2d colliders (not trigger) and 2d rigidbodys on both objects and set IsKinematic on one of the Rigidbodys. You can always use OnColisionEnter2D to call an event http://docs.unity3d.com/ScriptReference/MonoBehaviour.OnCollisionEnter2D.html

Comment
Add comment · Show 6 · 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
avatar image Pnvanol · Mar 19, 2016 at 07:18 PM 0
Share

Thank you, now one of them get pushed when colliding with the player, I want it to stay static, any idea?

avatar image Zoogyburger · Mar 19, 2016 at 09:33 PM 1
Share

Do NOT check Is$$anonymous$$inematic on the Player's Rigidbody2D and the other character check Is$$anonymous$$inematic

avatar image Pnvanol Zoogyburger · Mar 21, 2016 at 09:16 PM 0
Share

i think the problem is the way im moving the character in my character controller script I have if (Input.Get$$anonymous$$ey ("up")) { transform.Translate (Vector3.up * speed); WalkAnimation (0, 1, true); and that allows the character to actually go through the collider2d no matter way, any idea? it seems there is a bit of friction but it still manages to get past the walls...

avatar image Pnvanol Pnvanol · Mar 21, 2016 at 09:39 PM 0
Share

ok figured out the problem, i only had to move the character with the rigidbody rather than translating it

avatar image Zoogyburger · Mar 21, 2016 at 09:51 PM 0
Share

So is your problem all solved?

avatar image Pnvanol Zoogyburger · Mar 21, 2016 at 09:59 PM 0
Share

Yes, the trick was adding velocity which makes sense as that would craft the collision with the static coliders

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

53 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Stop ball sprite passes through the wall? 1 Answer

Hi . i am making a ninjump like game and i am having trouble on the start with with player sprite jumping script. 1 Answer

How To Smoothly Climb Over Tiles? 1 Answer

Hit from kinematic rigidbody2d 1 Answer

Sprite do not collide with another sprite (Even with collider and Rigidbody) [2D] 1 Answer


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