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 ben · Dec 24, 2010 at 05:43 AM · gameobjectpositionmouseclick

how can i fix a object in a particular place of another mesh or object by click on it

i would like to know how can i fix a object in a particular place of another mesh or object by click on the object which is placed away from that mesh or object

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

Answer by ben · Mar 08, 2011 at 11:09 AM

place the script in clickable object - in that script while mouse down , place the target object over it by getting the clickable objects position using transform function

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 The_r0nin · Dec 24, 2010 at 01:53 PM

Your need to separate out, programmatically, what it is you need to happen. Something like:

  1. Register mouse click on object
  2. Determine the place the object should move to.
  3. Move the object into place and set rotation.

Then work on each individually. As for step two, I have a GameObject that is my player. Then I parent the mesh to it (with the mesh as the child). Then I parent additional gameobjects for where I want other objects to appear. This way, if I want a missile to appear on a tank, I have an object in the right place tagged "missilespawn", and I can find the transform.position and rotation of that child to spawn the missile at.

Also, if you've rigged your model, you can attach your objects to the bones in the rig, just like if they were independent gameobjects... that's how most people attach guns to the hands of their characters...

Comment
Add comment · Show 2 · 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 ben · Dec 24, 2010 at 01:57 PM 0
Share

can u post the script

avatar image The_r0nin · Dec 24, 2010 at 04:45 PM 0
Share

No... the script depends on your objects, your setup, and what you want to happen. $$anonymous$$ost of it is set up in the inspector (and not scripted), anyway. If you post what you have, I can help you with the next step (or the part that is causing you problems).

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

C# Check If Scripted Gameobject goes Past Variable Gameobject 0 Answers

Position of a GameObject 2 Answers

How can i auto Position my Game Object? 0 Answers

How to tell if two blocks are right next to each other?(2D) 1 Answer

how to call a gameobject in one function(mouse selection) to another function (GUI) 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