• 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 flanagak · Dec 05, 2016 at 07:32 AM · rotationgameobjecttransformmesh

How to rotate child 3D object to match bend of mesh

Another new developer to Unity here so I apologize if this approach makes no sense.

So I have a project with a single flat mesh which can be bent by the user. (Think like Virtual Desktop or BigScreen and changing the curvature of the desktop)

I have 2 separate 3D models that I placed on either side of the above noted mesh. In the project I made the 2 models children of the mesh in the hierarchy.

What I am trying to do is to re-position and rotate the models as the mesh bends so they stay at the edge of the mesh and their orientation rotates to match the bend. ( Imagine a piece of paper with a paper clip on either side lying flat on your desk. Now curl the paper until the paper clips touch each other. Or think of a belt with clips on each end bending around a single radius, eventually coming together )

How do I keep my model objects attached to the edge of the mesh and have them rotate as the mesh bends?

Thank you, --flanagak--

Comment
Add comment · Show 6
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 Cherno · Dec 05, 2016 at 12:59 PM 0
Share

It would be cool if you could include a simple image showing what you are trying to achieve. I can kinda see what you are looking for, but it'd be a shame to spent time on helping on the issue only to find out I misunderstood the question after all ;)

avatar image flanagak · Dec 05, 2016 at 02:42 PM 0
Share

Here are a couple of pictures to help explain.

What I am attempting to do is make the objects on either side of the blue mesh appear as thought they are clamped to the edge of the mesh.

So as the mesh bends and the edges curl towards the camera, the objects stay fixed at the edge of the mesh and rotate to match the bend.

example-01.png (211.4 kB)
example-02.png (148.7 kB)
avatar image Cherno flanagak · Dec 05, 2016 at 03:17 PM 0
Share

I can't think of an easy or elegant way to do it. You'd have to find one of the triangles along the edge, and use it's normal to set the position of the object. This could be done via Raycast (not ideal since it's on the very edge, and requires a collider), or purely via code.

avatar image Glurth · Dec 05, 2016 at 04:10 PM 0
Share

What method are you currently using to bend the mesh? Are you modifying each vertex? If so, I agree with Cherno. Except that I think you will probably want to use the cross product of the edge-vertex normal, and the direction to the next-edge-vertex: the result will be perpendicular to both.

Show more comments

0 Replies

· Add your reply
  • Sort: 

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

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 keep a Gameobject in the same position after a transform.Rotate? 2 Answers

GameObject Rotation is always postive 0 Answers

Neutralising child rotations -> Parent 1 Answer

Adding Rotation to a Gameobject 1 Answer

Why Local Rotation Faster than World Rotation (Degrees/Second) 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