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 SVKsuli · Jul 18, 2014 at 12:18 AM · rotationtransformposition

transform.position on basis of rotation

hi, i need change position of object always on same length on basis of rotation. somethink like transform.position = Vector3(0,20,0); ,i try look on google but i dont see enythink what can help me. thx

Comment
Add comment · Show 2
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 · Jul 18, 2014 at 12:22 AM 0
Share

You need to provide significantly more information before someone can give you a targeted solution. A drawing would be very helpful. If I read between the lines and guess a bit, what you need to do is:

  • Create an empty game object and place it at the pivot point of your rotation.

  • Position your visible object at "same length' away from the pivot point.

  • $$anonymous$$ake the visible object a child of the empty game object.

  • Use whatever code to rotate the empty game object. You can set the transform.eulerAngles of the empty game object.

There are other solutions like Transform.RotateAround() and using a Quaternion to rotate a vector and then using the vector to position the object. This is all guesswork on my part.

avatar image SVKsuli · Jul 18, 2014 at 12:34 AM 0
Share

yes sory i try it explain... i create animation enythink how dust around my starship in space, when i go front it work good it going from up to down and again but when i rotate my ship(player) it still transform to same direction not front of my ship. here is script:

 #pragma strict
 
 var animator : Animator;
 static var speed = 0;
 var mypos : Transform;
 var playerpos : Transform;
 var maxdist = 20;
 var newpos : Vector3;
 
 function Start () {
     animator = GetComponent("Animator");
 }
 
 function Update () {
     if(speed > 30) {
         animator.SetBool("start",false);
     }
     else {
         animator.SetBool("start",true);
     }
     
     newpos = mypos.position + Vector3(0,50,0);
     
     var newspeed = speed * (-1);
     mypos.transform.rotation = playerpos.rotation;
     rigidbody2D.velocity = transform.up * newspeed * Time.deltaTime;
 }
 function OnTriggerExit2D(col : Collider2D){
     if (col.gameObject.tag == "PrachSpawner") {
         mypos.transform.position = newpos;
     }
 }

it still not done i only try how it work.

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.

Follow this Question

Answers Answers and Comments

2 People are following this question.

avatar image avatar image

Related Questions

transform.forward doesn't work in my code 3 Answers

how to ignore transform.position.y 3 Answers

Accurate placed object's transform messes up on game start 1 Answer

Game Object won't match rotation of new positions transform 1 Answer

Camera follow ball along cylinder 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