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 CrimsonChin · Jan 12, 2014 at 07:39 PM · 2d platformerground detection

2dToolkit and Physics2D.OverlapCircle

So, I picked up Unity with the 4.3 release and have only just started to make some things move around, jump etc. I had a simple piece of code to check if the player is grounded:

 grounded = Physics2D.OverlapCircle(groundCheck.position, groundRadius, whatIsGround);

It works great on a bog standard cube with a collider and layer set.

To get things moving I decided to buy 2dToolkit, mainly for the tile mapper, because IMO it's really tedious aligning sprites and drawing out levels in the current release.

I drew out a simple level, just a platform with a collder, set it the tile map layer [Tk 2d Tile Map (script) layers - > ground] BUT "grounded" never returns true. If I do the same thing with a cube and add it to the "ground" layer, no problem, it's just the tile mapper that doesn't seem to work.

  • sorry I know its a convoluted question. But if anyone with any experience could help me out I'd be grateful.

Comment
Add comment
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

2 Replies

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

Answer by JakeTBear · Mar 25, 2014 at 01:40 AM

This was a known bug, the 2D toolkit creates Edge colliders which are currently not responding to manual checks such as Physics2D.OverlapCircle.

http://forum.unity3d.com/threads/213191-Physics2D-Overlap-Circle-not-working-with-Edge-Collider-2D

Comment
Add comment · Show 1 · 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 CrimsonChin · Mar 25, 2014 at 08:22 AM 0
Share

I'm glad it's not just me. I was really frustrated buying 2Dtoolkit to get moving quickly only to run head first into this problem!

avatar image
0

Answer by leebs0117 · Mar 07, 2014 at 12:24 PM

I add a Circle Collider 2d on Player and write OnTriggerEnter2D() in Script

 public void OnTriggerEnter2D(Collider2D other)
 {

     if (((1 << other.gameObject.layer) & whatIsGround.value) > 0)
     {
         grounded = true;

     }
     else
     {
         
         grounded = false;
     }
     
     anim.SetBool("Ground", grounded);
     
     // Set the vertical animation
     anim.SetFloat("vSpeed", rigidbody2D.velocity.y);
 }
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

21 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

Related Questions

Disappearing platform problem - RigidBody2D and BoxCollider2D 0 Answers

2D platformer levers and moving platforms question. 0 Answers

Reset the velocity after the game has unpaused C# 2D 1 Answer

Character Jumps When Falling (Unity2D) 0 Answers

How to write a change Scene 2d for multiple scene 2 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