Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 GBFrank · Apr 01, 2014 at 08:07 PM · collisiontilemaptopdown

Top down tile based detection

Hi all and thank you for these invaluable forums.

In a nut shell.. I've been learning Unity for about 2 months and created a few test projects. a little space flight one and an orb puzzle game. No problems.

I made a tile based mesh with textures in a top down view and I can move a selector cube around with a mouse. I can debug the correct the tile number and data back no problems using the input.mouse to point my ray.

Question: I added a little 2d guy that moves around using the keyboard, great, but how do I now get the same information for the man concerning tile data that my input.mouse ray gave me.

I naively thought I would be doing some kind of Raycast from the player to the tiles but I am almost convinced that's very wrong. If someone can point me in the right direction I really would be eternally grateful. I use c#. I didn't add the code as it's the theory I believe I'm failing.

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 robertbu · Apr 01, 2014 at 08:21 PM 0
Share

I am almost convinced that's very wrong.

Raycast() will solve this problem. Not sure enough of your game, but if it is a regular grid, you can just find the information based on the xz position of your object.

avatar image GBFrank · Apr 03, 2014 at 02:05 AM 0
Share

Thanks robertbu, I finally figured out the raycast. It is working now and yes it is a regular grid. Thanks again

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

Simple top-down 2D collision 2 Answers

Stray tilemap collider being weird, won't erase 4 Answers

Differentiate between sliding collision and impact collision,Need to differentiate sliding vs colliding 0 Answers

Objects can't detect the tag of a tilemap collider? 1 Answer

How do I get collisions between Tilemap Collider 2d and a Kinematic Rigidbody 2d? 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