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 CameronSanders · May 17, 2016 at 08:10 PM · animationtransform.positionparent and childpreformance

Keeping (potentially hundreds) of object's transforms relative to animated counterparts? (Without Parenting)

I have two groups of objects: an animated one, and a non animated one. Both are identical in structure and my goal is to make each object in the non animated group welded to their respective counterpart in the identical animated group.

I am currently simulating this by updating the objects every frame in Update() to match their moving counterpart, but It's incredibly taxing on the engine. I'm trying to go for something that emulates the effect you get from a "parent child" relationship between transforms, only I need to keep them separate. Does a "Weld object A to always be relative to object B without parenting" method exist?

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 phxvyper · May 17, 2016 at 10:09 PM

This is the sort of thing I would do, in a controlling script that manages connections between objects and counterparts:

 struct WeldConnection {
     GameObject parent;
     List<GameObject> children;
 }
 
 List<WeldConnection> Connections = new List<WeldConnection>();
 
 void Update() {
     foreach (WeldConnection connection in Connections) {
         foreach (GameObject child in connection.children) {
             child.transform.position = connection.parent.transform.position;
         }
     }
 }

Even though its basically what you're doing already. Also, this sort of thing isn't that taxing on Unity. In fact, its one of the simplest and fastest operations. Take a look at the profiler in Unity to see how much CPU is being used here. This is a relatively reliable method of doing this.

Also, why do you need to keep them separate? You can always change parents via transform.SetParent

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 CameronSanders · May 17, 2016 at 11:19 PM 0
Share

Thank you for the response. The reason I need them separate is because the objects in question are armature bones. What I am doing is attaching multiple objects with armatures and meshes (bone by bone) to an animated armature like an overlay. It's the current method I am using to have interchangeable body parts on a character. So I guess my end goal is simply to have a better method for doing the attaching.

Example: alt text

model.png (92.2 kB)
avatar image phxvyper CameronSanders · May 20, 2016 at 10:30 PM 0
Share

I see parent-child used often. I'm certain you can figure out how to create that relationship in code. Do some googling around see if you can find any better suggestions than what I've given you.

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Overriding the animation movement speed using transform 1 Answer

Random Animation of gameObject Children 1 Answer

Animator and Transform not synchronized 2 Answers

Stand to Sit Animation not working correctly 0 Answers

Change animation at runtime with Mecanim 0 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