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 /
This question was closed Mar 01, 2018 at 08:40 AM by TR33 for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by TR33 · Feb 28, 2018 at 06:55 PM · rotationtransformdirectionmove object

Moving an object with dependency of it's rotation

Hi guys,

So I'm spawning objects in a circle and want to move them further away from the middle point of the circle. Every object is facing a specific direction (away from the middle point). Now I want to increase the diameter of the circle by moving all objects away from the middle point (in the direction they are facing)

I tried Vector.up but that was obviously not working... So I tried Vector3.up with localPosition but that wasn't working either. Do you have any suggestions what to use? I stumbled across Transform.InverseTransformVector and Transform.TransformDirection.

They sound pretty good but I have no clue how to use them. Does anyone have an idea?

BTW: I don't want finished copy-paste code. I want to understand this s$$t ;) so I can use it myself in other projects :)

Thanks for your help.

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

  • Sort: 
avatar image
0

Answer by dishant27 · Feb 28, 2018 at 07:18 PM

Firstly, create a circle equation keeping center = middle point and radius = distance from the middle point. Now from that equation define x in terms of y say f(y) or y in terms of x say f(x). It's your choice to use either (f(y), y) or (x, f(x)); I'm explaining using (x,f(x)). Now, Instantiate at objects on that circle by providing any x value on that circle and f(x) will decide the corresponding value of y. By varying the value of x, you can spawn objects on that circle at different positions. Make each object face to the center by using Unity's LookAt() method. Now, transform using localPosition axis(facing towards center) to move away from the center.

Comment
Add comment · Show 9 · 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 TR33 · Feb 28, 2018 at 08:19 PM 0
Share

Hmm I think I didn't explain it really well. I have 40 spawnpoints in shape of a circle. I have already instantiated an object at a random point. $$anonymous$$y problem is that i have different things to spawn with diffrent hights. So I want to move them up or down by half their size.

avatar image dishant27 TR33 · Feb 28, 2018 at 08:34 PM 0
Share

Now it's more confusing. In question, you are saying "increase the diameter of the circle by moving all objects away from the middle point". But in comment, you are saying "move them up or down by half their size."

avatar image TR33 dishant27 · Feb 28, 2018 at 09:06 PM 0
Share

Well I thought that would make it easier to explain. When you can imagine a circle.... Whatever. Sorry if my original question was misleading. $$anonymous$$y original question should be "How can I move an instanciated obejct relative to its rotation" :)

Show more comments

Follow this Question

Answers Answers and Comments

120 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 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

Bouncing Ball Problem( bounces vertically forever) 1 Answer

[JS] transform.rotation not working 1 Answer

Quaternion rotation with normals bug: Only works into one direction? 1 Answer

rotation relative to a transform 1 Answer

How to rotate instantated prefab without rotating it's local directions by javascript? 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