Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 Redaa · Jul 14, 2015 at 06:34 AM · unity 5movementphysicsphysics2d

2D Smooth movement and collision detection problem

Hello guys, I'm trying to figure out a solution for my game, I created it but am not happy with the "mechanics" so far. So, the game is a board game the board is 42x42, there is a character of course that can move in the board, also there are collisions with enemies and walls and other objects. The game being mostly a strategy game i represent the player's position with (x, y) while x and y are in N (1, 2 , 3 ... 42).

The first problem is the movement, since i want my player to be able to move, I increment or decrement x or y to change the position on the board, but this had a fast movement for the player so i added a slide effect, which checks the position (x and y) and it's equivalent position in the world, and moves smoothly the player in a period of time using the function: Lerp but the movement is still not there, something is missing.

The second problem is collisions, for the collision system, i disabled all Unity's collision system + physics system, i check collision against the 42x42 array (ex: if the player(1, 2) is trying to move right and the column(2,2) contains a wall => deny movement) it's working like a charm but it's a pain to iterate throught an array of 42x42(i don't iterate every update but it still a pain), so I guess if i can move the objects "properly", i can enable the 2D collision system because it's more optimized.

Enough bla bla, time for direct questions. How do i get a smooth and correct 2D movement in Unity, By correct i mean moving in the board from (1, 2) to (21, 2) with the same speed and without any sluttering ... I've seen the ROGUELIKE tutorial, i don't want that kind of movement since the player can do only one step at a time, in my game the player can move in the board from (1,2) to (42, 2) with the same speed, and if you repeat the process (moving from(1,2) to (42,2)) it will be always the same time.

Any questions, i'm here, thanks a lot :)

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

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

2 People are following this question.

avatar image avatar image

Related Questions

Is there a standardized way for creating a 2D ball physics movement method? 0 Answers

Need help with my movement script.. :( 1 Answer

Problem is not Bouncing 0 Answers

Moving a non-player object in a random direction which bounces off other objects. 2 Answers

How do I make my character controller jump when I use this code? 0 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