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 Zankaster · Feb 15, 2014 at 01:21 PM · horizontal movement

2D Character gets stuck while crossing 2 plane tiles

Hello everyone, today I started noticing that my character was a bit shaky on the Y axis while running on a simple plane (series of square tiles), and I checked in the inspector at runtime and I actually found out some slight variations on the Y of the transform. I have a box collider for the top and a circle for the feet, so I tried to remove the circle and add another box for the lower part. The Y movement finally stopped, HOWEVER now the character randomly gets stuck when crossing two adjacent tiles. Not quite randomly, I noticed it happens sometimes when I change direction, it must be a combination of position (relative to the end of the tile) and character velocity that triggers this. It really makes no sense to me, since the tiles have a dimension of 1 in unity, and their collider is also 1x1, plus I placed the tiles perfectly one next to each other using vertex snapping, and at integer positions just to make sure unity wasn't doing some rounding error, so the character should slide with no problem. Both character and tile materials have 0 friction and bounciness. Also they have rigidbodies, with fixed angle, and the tiles are also set to Is Kinematic. I spent the whole morning doing tests changing parameters with no luck, I even doubled the tiles collider size (so they overlap), and the player still gets stuck at the boundary. Basically when it gets stuck, even if I press D the animation runs but the caracter doesn't move, to move it again in that direction I have to step back first. Here's the code for the movement, very simple:

 float move = Input.GetAxis ("Horizontal");
 rigidbody2D.velocity  = new Vector2 (move * maxSpeed, rigidbody2D.velocity.y);

Sorry for the wall of text but I wanted to give you as much information as possible. Thank you in advance.

Comment
Add comment · Show 4
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 Zankaster · Feb 15, 2014 at 03:06 PM 0
Share

I just wanted to say that I found out that it is a known problem http://forum.unity3d.com/threads/195940-Sliding-2D-Rigidbody-catches-on-box-collider-corners-and-quot-jumps-quot Any idea if they fixed it someway with Unity 4.3 or if anyone found a workaround?

avatar image sdgd · Feb 15, 2014 at 03:46 PM 0
Share

I heard they are currently mainly focusing on 2D so I guess your best bet is to try latest version if that's fixed, ALSO make sure you make a backup especially for 2D project because IT could happen something won't work, ...

But that densest mean that it won't.

avatar image Zankaster · Feb 15, 2014 at 07:49 PM 0
Share

I updated to the latest version, the problem is still there unfortunately. I did some other tests on a playground project with just a row of tiles and one on top as a player, I found out that if you increase the scale of the items, the box collider does no longer get stuck. The circle collider still gets some fluctuations on the Y axis, but because of the scale they get quite negligible it seems. So the question now is if the scale increases exponentially the computational weight. I would say so, but maybe if you use gameobject all pretty much of the same size, unity is smart enough to optimize... Who knows, doing another search on the subject!

avatar image Mijdax · Sep 26, 2014 at 02:40 PM 0
Share

I have the same issue. I am currently using 4.5.4f1. Is there any workaround?

EDIT: $$anonymous$$y solution was now -> Change the Box Colliders to Circle Colliders.

0 Replies

· Add your reply
  • Sort: 

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

20 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

Related Questions

Swapping Horizontal Input for Mobile 0 Answers

UnityException: Input Axis Horizontal is not setup. 1 Answer

Horizontally scrolling across children having grid layout and parent having horizontal layout 0 Answers

Why isn't this input working? 1 Answer

How can my character move horizontally with Rigidbody.MovePosition? 3 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