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
1
Question by Satyapatr · Oct 29, 2017 at 12:28 AM · transformobjects

Pull Apart

Hello,

I have question, how to make feature in unity like image i attach, so basically when i slide on GUI, object on the children of my model automatic pull.

alt text

alt text

1.jpg (114.9 kB)
2.jpg (179.3 kB)
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 Bunny83 · Oct 29, 2017 at 02:21 AM

What you want here is an exploded view. However there's not really a way to fully automate this for an arbitrary mesh / object and have the parts still nicely aligned.

However you can simply move the parts outwards from the centerpoint. Of course this will only work if your "parts" are actual seperate objects. If your model is a single mesh it's not possible as there's no information which "triangles" belong to the same object.

As pseudo code it would look something like:

 foreach part
 {
     part.position = centerPoint + (part.originalPosition - centerPoint) * distance
 }

So all you need is to store the original position of each part so you can update the current position this way. The "distance" value would determine how far the objects are apart. The normal value is "1" in which case the objects are in their original positions. If the distance is "0" all objects would collapse to the center point. If it's greater than 1 they will move outwards.

Comment
Add comment · Show 4 · 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 Glurth · Oct 29, 2017 at 03:02 AM 1
Share

In the image it does not really look like they move directly away from the center point. Some parts move down, some up, some forward (in worldspace). This would require that each child object specify a direction, in world space, along which it's position is adjusted. similar formula:

 part.position = part.originalPosition + (part.expandDirection * distance);

However, if one defines every single $$anonymous$$esh asset such that: the direction it "connects" to its parent-part is along... say... the LOCAL y-axis with the connection point at the LOCAL origin, then one can simply increase/decrease each mesh object's localPosition.y to pull them apart/together.

avatar image Bunny83 Glurth · Oct 29, 2017 at 03:49 AM 0
Share

Right, that's why i said:


there's not really a way to fully automate this for an arbitrary mesh / object and have the parts still nicely aligned


Specifying a seperate explosion direction for every part requires a lot work if you have many parts. Also most animated exploded views even expand in multiple steps. It's usually ment to show the order of assembly.


For example have a look at the air intake on the right side. It moved to the right in a straight line but the screws / rivets around expanded radially outwards from the moved intake. If you would combine both motions into a single direction and speed you would need a different direction and speed for every part. If you actually need different sequences you actually need to create a fulll grown animation like this one.


So my approach allows an automatic handling based on a center point. Of course you would get a better result to fine-tune the movement of every part.

avatar image Glurth Bunny83 · Oct 29, 2017 at 01:03 PM 0
Share

I know it looked like a reply to you Bunny, but I was just trying to provide some more practical details for the OP, that I didn't think required a separate answer.

avatar image Bunny83 Glurth · Oct 29, 2017 at 04:15 AM 0
Share

some other examples of how you usually create an exploded view in a CAD software.

https://www.youtube.com/watch?v=A0wYOtjGmE0

https://www.youtube.com/watch?v=lFROVhDJL_c

https://www.youtube.com/watch?v=1bcX-pAd_7g

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

73 People are following this question.

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

Related Questions

onmousedown on object teleport 1 Answer

Make an object mimic the rotation of another one according to their orientations 2 Answers

Movement on roads issue 1 Answer

Adding a transform component to an object which is not in the hierarchy 1 Answer

How do you access the transform component of an object in another class? 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