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
0
Question by Donnerspants · Mar 17, 2014 at 05:39 PM · transformrotate objecttranslateperpendicular

How to move child objects perpendicular to parent object's rotation?

Hey,

I have been stuck on this problem for a week now and would love if someone could help me out!

I have 3 planes(see image below). Plane A is a parent of Plane B and Plane C. All three planes rotate together.

My problem is when the user clicks on Plane A; Plane B and Plane C should stop rotating, separate from Plane A and move perpendicularly to Plane A's current rotation. Planes B and C should fire in opposite directions to each other.. alt text

Any ideas on how to accomplish this using JavaScript? It has been driving me crazy!

Thanks!

untitled-1.png (13.4 kB)
Comment
Add comment · Show 5
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 robertbu · Mar 17, 2014 at 06:09 PM 1
Share
  • Does 'A' continue to rotate after 'B' and 'C' are launched?

  • How are you planning to move 'B' and 'C'...Rigdibody? CharacterController? Direct movement of the transform?

  • What defines the destination for the movement of 'B' and 'C'?

  • Are 'B' and 'C' children of 'A'? And if so, do they remain children after they are launched?

avatar image JohnRossitter · Mar 17, 2014 at 06:46 PM 0
Share

Are you making these in the Scene View or creating them at runtime? I would be curious to know what your parenting looks like in the Hierarchy pane. Supposing that they were child objects, and had their pivot points in the right place, it should work.

avatar image Donnerspants JohnRossitter · Mar 17, 2014 at 07:28 PM 0
Share

Hey John,

Thanks for replying..

I am making these in the Scene view. Plane A rotates from the start. B and C rotate with it. As soon as the user clicks on Plane A, B and C need to fire(like bullets) in opposite directions to A's current rotation.

avatar image perchik · Mar 17, 2014 at 06:48 PM 0
Share

Yeah, I think more information on how you're moving these things is in order, if we're to help you. Depending on how you do it, it may be as simple as moving in the direction of A.transform.up or something, but without knowing how you move/rotate the objects it's hard to say.

avatar image Donnerspants · Mar 17, 2014 at 07:22 PM 0
Share

Hey thanks for replying.. Plane A's mesh will be disabled once clicked. B and C are bullets. They have rigidbodies and I assume I will addforce to move them?

Plane 'A' has a simple rotation script attached to it to make it rotate. Plane 'B' and 'C' rotate with it automatically because they are its children.

Planes 'B' and 'C' are children of 'A' but I am unsure if they should remain children once Plane A is clicked.

$$anonymous$$y goal is to fire 'B' and 'C' in opposite directions to 'A'

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by JohnRossitter · Mar 17, 2014 at 07:28 PM

I would detach B & C from A first before disabling A.

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
avatar image
0

Answer by koray1396 · Mar 17, 2014 at 07:48 PM

well, someone brighter than me will probably advise something else. but this would be my way if I understood right;

On mouse down, you can stop rotation and store the eulerAngles of A. Then, C.transform.localPosition.x should move away by somevalue sin(z rotation of A) deltaTime, and local y position would move by somevalue cos(z rotation of A) deltaTime.

Likewise, the movement of B would be the opposite.

I hope this would be useful for you.

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 Donnerspants · Mar 22, 2014 at 11:23 AM 0
Share

Thanks $$anonymous$$oray! This helped a lot

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

23 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

Related Questions

Best way to move a Rigidbody2D from point A to point B (Mouse Position) 3 Answers

Different between transform.Translate() and Vector3.MoveTowards? 1 Answer

move enemy to random transform array 2 Answers

Moving an object towards a clicked object 1 Answer

How I can Converting a Direction Vector to Quaternion rotation? 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