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 Jakeiiii · Aug 01, 2014 at 08:12 PM · 2dmovementrigidbody2dsmoothtiles

Unity 2D - Smooth movement over tiles??

So I've basically built a level out of 64x64 tiles, each tile has it's own collider. For example, the flat ground tiles are just plain box colliders, and so I have used the scene view's vector snapping function to line them all up neatly. Problem is that even though they're neatly lined up, the fact that they're separate box colliders gives the player bumpy movement when running along these aligned tiles. A quick fix is to just set the y velocity to 0; however when the player moves down a slope, this cannot be zero, and I haven't found a way to set a 'relative y velocity' to zero. Another idea would be stretch a single collider over a collection of tiles, however this can get inconsistent with the position of the tiles.

So does anyone have any suggestions on how to counter this issue?

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

1 Reply

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

Answer by Jakeiiii · Aug 03, 2014 at 12:14 PM

Okay, so I've come up with a solution. Just made a script that is attached to a basic shape (say, a square), and if I want to make a long flat plane then I increase it's local scale and instantiate tiles along it based on it's scale. So if a standard 64x64 block has a localscale.x of 3 (so I want it 3 tiles long), I instantiate tiles using a while loop so that when i=0, it creates one at origin; when i = 1, it creates one at 0.64 to the right of the origin's x and one to the left. Also it's adjusted for a localscale.x that's an even number so it creates on at 0.32 to the right/left of the origin's x. And of course if the tile is a slope then the y value has to be adjusted too. As a result, the (one) collider is just on that basic shape that stretches across the tiles which are just plain sprites. Problem solved!

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

2 People are following this question.

avatar image avatar image

Related Questions

How to rotate an RigidBody2D object to an angle and get back to the previous position in the smooth way? 1 Answer

Complex 2D movement (X,Y) using velocity. 1 Answer

[Solved] Rigidbody2d smooth movement 1 Answer

How to push an object in 2D grid style 0 Answers

2D Game, Character Slides off Slopes, Need to be Able to Walk on Them 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