Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 TomatoOrgyLT · Oct 30, 2016 at 11:47 PM · movementteleportblocksroundgaps

NES Battle city like movement when turning (teleporting to fit through the gap of blocks without getting stuck)

This is what I'm talking about https://gyazo.com/20bd71273164bd1cfe0f276ecf83e690

As the title say i'd like to make my tank move through the gap smoothly without making the tank collider smaller. For example, if I'm moving right and I'd like to go through a gap between blocks with a pathway leading up, I would teleport in front a bit when the "up" key is pressed.

I was thinking about rounding the numbers using Mathf.Round but I have no clue how to implament that. Would really appreciate any sort of suggestions.

Comment
Add comment · Show 2
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 Sergio7888 · Oct 31, 2016 at 04:40 PM 0
Share

Remove your Square Collider of your tank and use a Circle Collider.
Or $$anonymous$$ake the square collider a trigger and add a Circle Collider for navigation.
Or use 2 objects in different layers in one you put her square collider for collide with bullets, in the other object you use a circle collider to collider with the walls, and change the collision matrix in Physics2D.

avatar image TomatoOrgyLT Sergio7888 · Nov 02, 2016 at 12:09 AM 0
Share

I suppose that would work, but I want is that choppy teleporting movement and circle collider does not provide that. It would just slide a bit reducing speed until it fits into the gap.

2 Replies

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

Answer by TomatoOrgyLT · Nov 02, 2016 at 12:12 AM

Here's an answer I was looking from a guy from youtube called Ivan Enzhaev

Snapping a tank is very simple. For example your tank has width = 32 and it is moving to right (x, y) -> (0, 0) -> (1, 0), (2, 0) -> .... When you press Up key you need to around X coord. For example, I created an array for X: 0, 16, 32 So If you move to right and pres Up key you need to add to Up key handler a calculation of X coord. For example: if X = 14 you need to set for X coord a value = 16

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
avatar image
0

Answer by jmgek · Nov 02, 2016 at 12:54 AM

Don't use Colliders, make a 2D array and set each element to either 1 or 0, If the player moves check the array and if it's 0 don't lerp to that position, if its a 1 lerp the tank to that position. Also this gives you the ability to spawn the world, at startup check if the element is 0 and if so spawn your brick tile.

Try to stay away from any kind of physics!

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

69 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 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 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

Shifting blocks to the right to remove empty spaces - C# 0 Answers

How can I make a collision sensitive teleporter for a 2D game #c 1 Answer

Teleporting device? 1 Answer

Trouble with Round Generating 0 Answers

Character Can't Move After Position Change 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