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 aled96 · Jul 01, 2014 at 11:06 AM · 2dcollisioncollision2dplatform

Unity2D collision problem

Hi, i am making a 2D platform game. In this game there are some boxes that are in the air (they are side by side). Each of this boxes has its own box collider 2D.

When my character (with his box collider2D) jumps on the boxes there isn't any problem. The problem apperars when the character tries to move on the boxes.. Because sometimes he can't go on.. I think that this is based on the boxes' colliders...

Have you got somo solutions or something else ? :)

If you need any further information, ask me :)

Thank you so much:)

Comment
Add comment · Show 6
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 aled96 · Jul 01, 2014 at 11:11 AM 0
Share

I have a solution, but i don't know if it is good..

I can create an Empty GameObject and make the boxes( without the box collider) as its children. And the put the collider in the gameobjecct and adapt to the boxes :)

It works but i don't know if there is a better way

avatar image RakshithAnand · Jul 01, 2014 at 11:11 AM 0
Share

What do you mean by he cant go on?

avatar image aled96 · Jul 01, 2014 at 11:14 AM 0
Share

If i try to walk on the boxes, the character stops moving...

avatar image RakshithAnand · Jul 01, 2014 at 11:35 AM 0
Share

Can you please show the code you have written for character movement?

avatar image aled96 · Jul 01, 2014 at 11:50 AM 0
Share

float h = Input.GetAxis("Horizontal"); anim.SetFloat("Speed", $$anonymous$$athf.Abs(h));

if(h rigidbody2D.velocity.x < maxSpeed) rigidbody2D.AddForce(Vector2.right h * moveForce);

             if($$anonymous$$athf.Abs(rigidbody2D.velocity.x) > maxSpeed)

rigidbody2D.velocity = new Vector2($$anonymous$$athf.Sign(rigidbody2D.velocity.x) * maxSpeed, rigidbody2D.velocity.y);

Show more comments

3 Replies

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

Answer by bhartu · Jul 01, 2014 at 01:29 PM

you can put circle collider2D and give physics2D material with low friction. it should work.

Comment
Add comment · Show 3 · 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 aled96 · Jul 01, 2014 at 04:16 PM 0
Share

is too big circle.. there is something like capsule in 2d ?

avatar image incorrect · Jul 01, 2014 at 06:45 PM 0
Share

Oh, c'mon, you can add several colliders. Look that 2D-tutorial, man.

avatar image aled96 · Jul 04, 2014 at 10:50 AM 0
Share

I tried to use a circle collider but the problem persists...

avatar image
0

Answer by incorrect · Jul 01, 2014 at 11:22 AM

my character (with his box collider2D)

Just open the example 2D-project provided by Unity and look how it is done. It should have circle collider, btw.

Comment
Add comment · Show 2 · 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 aled96 · Jul 01, 2014 at 11:27 AM 0
Share

No, i put a box collider not circle..

avatar image incorrect · Jul 01, 2014 at 12:52 PM 1
Share

@aled96, I've noticed. But for some reason circle collider is used for characters. Try looking 2D-tutorial. ;)

avatar image
0

Answer by timvanderweijde · Jul 01, 2014 at 08:27 PM

The rigidbody2D component of the boxes should probably be set to "Is kinematic" is true. (checkbox) Otherwise other forces like gravity will effect the position of your boxes.

I quess there will me a really small edge where your characters stops.

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 aled96 · Jul 04, 2014 at 10:49 AM 0
Share

I need to use gravity

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

25 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

Related Questions

Box Collider 2d Not Colliding 0 Answers

My OnTriggerEnter2D(Collider2D other) not working 1 Answer

One-way platform's side causes collision with Platform Effector 1 Answer

Ignore collision 1 Answer

How to move objects away from each other (not what you think) 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