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 tenthplanet0 · Jan 04, 2013 at 07:27 PM · gameobjectvector3

Accessing game object based on position

Hiii developers, please help this new bee. I want to access game object based on its position. How can I do this? Is it possible?

I have to make a game in which there are multiple cubes available. Cubes with same colors have to be deleted if they are attached and more than two.

I was thinking that if they are accessed as per there position i.e. current cube is red color, above cube(aboveCube.position.y == curCube.pos.y+1) is red color, left cube((leftCube.position.y == curCube.pos.y+1)) is left color and then clicked then destroy.

Actually I am unable to write what I am willing to say, but you can get if you will see the game

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by Piflik · Jan 04, 2013 at 09:56 PM

If you want to get the object that enters a specific area, the best way to do that would be OnTriggerEnter, with a collider specifying the area. You can compare an objects position with a certain Vector3, but if you want to get all objects that are within a certain threshold around that position, you would have to iterate through all objects in the scene, every frame (or at least in a sufficient subset of frames), and calculate their distance to the Vector3 specified, which is not very efficient.

Comment
Add comment · Show 1 · 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 tenthplanet0 · Jan 05, 2013 at 07:00 AM 0
Share

I want to make this game

http://www.gamefools.com/onlinegames/free/supercollapsepuzzlegallery2.html

but I am not able to change the colour of similar attached boxes

avatar image
0

Answer by Vonni · Jan 04, 2013 at 09:40 PM

Yes. But you should be more specific!

Comment
Add comment · Show 1 · 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 tenthplanet0 · Jan 05, 2013 at 06:55 AM 0
Share

Ok... Thanks

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

10 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

Related Questions

2D Get Object Height to stack up on the screen 1 Answer

How to shoot a bullet on a moving object,How to shoot a bullet from an object moving in the direction of motion 1 Answer

C# Creating a 2d boundary 1 Answer

Getting a point in relation to an object with a different axis alignment 0 Answers

Distance between a gameObject and a direction vector. 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