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
1
Question by TheOz · Feb 12, 2012 at 08:04 PM · animationinstantiatechild

Attaching Object as child at certain point in animation

Hi Gang,

I have an archer that is reaching back to withdraw and arrow from his quiver and shoot it. I am instantiating the arrow in the quiver. During his animation when he reaches back to draw the arrow I wish to attach it to his hand and then as he shoots the arrow launch it as a projectile. I can easily instantiate the object as a child of the hand but I wish to time it with the animation drawing the arrow from the quiver.

Is there a way to attach an object as a child to a parent at a certain point of my choice during the animation?

Thanks, The Oz

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
2

Answer by AprendaGames · Feb 12, 2012 at 11:23 PM

Use an animation event: http://unity3d.com/support/documentation/Components/animeditor-AnimationEvents.html

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 TheOz · Feb 14, 2012 at 01:47 AM 0
Share

Thanks after I set the animation event at the appropriate location I created a function to Transform.find the parent (hand) and attached the arrow object as a child to it.

Thanks again.

avatar image
2

Answer by TheOz · Feb 14, 2012 at 02:13 AM

Thanks That got me on the right track. After creating an event where I wanted to attach the arrow to the hand I created a function in the script on the character and did the following:

 function drawArrow() {
 rightHand = transform.Find("Pelvis/Spine1/Spine2/Spine3/Spine4/Ribcage/RCollarbone/RUpperarm/RForearm/RPalm");
 arrow = GameObject.Find("Arrow(Clone)");
 Debug.Log("found :"+arrow);
 Debug.Log("found :"+rightHand);
 arrow.transform.parent = rightHand.transform; // this should attach the arrow to the right hand of the archer
 transform.localPosition = Vector3(0,0,0); 
 rigidbody.isKinematic = true; 

One thing I found was that you had to drill down the characters bone structure with transform.Find to get the right parent before attaching.

The Oz.

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.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How do instantiate stuff as a child 4 Answers

Smart way to add border to a text mesh in a 2d environment 1 Answer

VUFORIA: Playing an animation for a instanced model? 2 Answers

Destroy the child instantiated object 1 Answer

Instantiating multiple prefabs with animations all appear at 0,0,0 3 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