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 unitydev0008 · Jan 13, 2011 at 07:49 PM · gameobjectsendmessagefindgameobjectswithtagmagnet

Magnetic Gameobject

Hey guys i was just curious about what the best way to make a magnetic type gameobject. I have a game where the players control paddles but also can shoot projectiles across the screen. I also have an ability to make the paddle magnetic( although it doesnt do anything yet), and i was wondering how to best make all enemy projectiles move towards the players paddle like it was being pulled by magnetic force.

Now the way i was thinking was to do a getgameobjectswithtag and do a sendmessage to all projectiles to lookat the paddle with a quaternion.slerp to make it slowly face the paddle but the problem would b that only the gameobjects that are spawned when the paddle gets set to magnetic will be pulled and any other projectiles that are instantiated will not get the sendmessage.

The only way i can think of then would b to lookup the gameobjectswithtag every frame while the paddle is magnetic( 10 sec duration) which to me doesnt sound like the best alternative. I am newer to scripting so my techniques are limited so if anyone knows a better more effiecent way to do this please share and/or if doing it this way could work let me know.

Thanks again!

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
1
Best Answer

Answer by Borgo · Jan 13, 2011 at 08:07 PM

You can use joints, best and easy way.

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 unitydev0008 · Jan 13, 2011 at 11:00 PM 0
Share

Im not familiar with joints at all...any tips to get me started? or how to implement it... not askin u to do tha work jus get me started in the right direction thanks for the quick response too ill go check the documentation and see if i can figure out anything in the mean time.

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

No one has followed this question yet.

Related Questions

Cannot implicitly convert type `UnityEngine.GameObject[]' to `UnityEngine.GameObject' 1 Answer

Destroy all GameObjects at once 5 Answers

SendMessage to all *tag* within range 1 Answer

Destroy the first GameObject out of x fired 1 Answer

How do I both "find" this and stop it from emitting? 2 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