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 stratos_kakalis · Jun 10, 2016 at 01:51 PM · gameobjectsmultiple

Checking if multiple GameObjects do what one has to....

I really couldn't come up with a good title so please bear with me as ill try to explain what my problem is.I am creating a standard FPS game and (just like many other FPS games) when there's a weapon on the ground i want the player to be able to grab it and drop the one he is holding.Before i explain the way i did it (because its not working) I want suggestions on how you would make it.Basically im tracking if that gameObject is withing the screen and if the player presses "E" he picks it up.How can i track multiple gameObjects for example a room filled with AK_47 (i am now only taking the tag of the gameObject so can only target one of them at a time as i am checking if that one is within the screen limit).Its been a lond day and im very tired so I apologise in advance if all i just typed makes no sense :P i really need some help.In brief, whats the best way to track which weapon im next to or at least how to track multiple of that one weapon.

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 cjdev · Jun 10, 2016 at 02:01 PM

You could try using a collider on each weapon and when the collision happens register that weapon as valid to pick up. If you need to pick it up anywhere on screen you can cast a ray out to the colliders instead of using the collision with a character controller.

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 stratos_kakalis · Jul 27, 2016 at 06:58 AM 0
Share

Thanks for the response. I found another great way to overcome the issue by giving all the guns (all variations models, not of a certain kind) one tag and then looping through all of those and finding the ne closest to me, if that gun was within screen space and a small distance from the plahyer i grab it. I didnt want to add colliders to all the guns in my scene for performance issues just leaving the way i did it here for future reference .Thanks again for your reply :)!

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

44 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

Related Questions

Problem with multiple gameobjects using same script. 0 Answers

[C#] Translate.position a lot of gameobjects at once (due to velocity limitations) 0 Answers

Destroying objects with the same name that are touching eachother. 1 Answer

OnTriggerEnter() not firing for mutliple objects 0 Answers

how to detect an gameobject on mouse click using raycast 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