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 rbazzi · Jan 13, 2017 at 09:59 AM · 3dcollidersobjectscustomization

Reposition objects during character customization

So I have a robot that can be customized.

Each part of the robot (Head, Torso, Arms, Legs) can be changed with different shapes and forms.

The robot looks like this (I'm using Unity objects for now) :

alt text

Let's say the user changes the Torso and decides to put a cube torso instead of the rectangular one, then it would look something like this :

alt text

Now in both cases, the parts aren't really joined together, you can clearly see space between the head and the torso, the arms and torso, the legs and torso.

Regardless of the shape and form the user chooses, the end result should look like this img link without any spaces.

Each part has its own collider (Box/Sphere/Cylinder), so I was thinking of moving a part (ie: Head) downwards until it collides with the Torso so that it sits on top of the torso removing unwanted space.

What do you think of this approach? Is there anything simpler?

1.png (114.5 kB)
2.png (95.4 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
Best Answer

Answer by Hellium · Jan 13, 2017 at 10:07 AM

Using physics may not be a good idea for this purpose I guess.

What I advise you :

  1. Each part of your robot must provide empty gameObjects called "AttachPoints"

    • Each head must have its attach point at the bottom, the torso must have 5 attach points, ...

  2. Each part of your robot must have a script referencing their attach points

  3. When changing part of the robot (except torso), move the part so that its attach point is attached to the attach point of the torso

    • For the head, you may have : this.transform.position = torso.headAttachPoint.position + ( this.transform.position - this.torsoAttachPoint.position ) ;

  4. When changing the torso, move all the parts of the body so their attach points are attached to the attach point of the torso

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 rbazzi · Jan 13, 2017 at 01:54 PM 0
Share

Thank you for the reply! I am going to try this and will get back to you soon! :D

avatar image rbazzi · Jan 13, 2017 at 03:32 PM 0
Share

Ok so I tried your solution and it works!

I modified the torso to see if the solution is going to respond the same way on a different size and it worked too given that the AttachPoint doesn't change position which is the case!

Last question, I assume the formula is roughly the same for the rest of the parts right?

Thanks again!

EDIT: I tried it with the legs and it works too! Same formula different body parts! Thanks! :D

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How To: One collider for detection; one for collision. 1 Answer

How to restrict movement towards a collider. 1 Answer

Issue regarding combination of objects 2 Answers

My 3D collider is not detecting colissions. 1 Answer

Can I make a hole in a mesh collider? 2 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