• 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 KSLR · Nov 09, 2010 at 08:54 AM · instantiatetransformpositiondynamicbone

Dynamically Update Instantiated Objects Position

Is it possible instantiate an object once in the manner of "OnMouseUp" and then define its transform position of a bone that in on a model in a scene? I desire a laser beam to attach to a models bone and move with it.

Thanks M8s

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

Answer by skovacs1 · Nov 09, 2010 at 04:50 PM

"define its transform position of a bone that in on a model"? I have no idea what that is supposed to mean. Please consider rephrasing.

Your description is quite poor. Do you mean the OnMouseUp function which only happens when the mouse is released over an object with a Collider or OnMouseUp in general which would be if(Input.GetMouseUp(0)) or the like?

Going from what you describe in the latter part of your question, you want an object "laser" to move with some other object "bone", right? That can be achieved through parenting:

var bone : Transform; //instance in the scene. Get it however you like. var laser : Transform; //prefab var offset : vector3; //Where to place laser relative to bone

function OnMouseUp() ( if(!laser || !bone) return; var instance : transform = Instantiate(laser, bone.TransformPoint(offset), bone.rotation); instance.parent = bone; )

If your laser is a particle system or something that you turn on/off often enough, it is simpler to just add this part to the prefab and turn it off/stop emitting. Please see the 3D platformer tutorial's jetpack example of how to do this.

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

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

I need help with the location of instatiated objects on the scene and correct interaction with this 2 Answers

Copy position from one object to another on one axis 0 Answers

How to instantiate object at particular location 1 Answer

Instance child global position 1 Answer

How can I Instantiate a prefab (projectile) consistently from the character? 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges