x


rotateobject at a specific angle

I'm trying to rotate an object around another object at a set angle.. code I have (non-working) is below :

transform.RotateAround (GameObject.Find("planet"+oPlanet).transform.position, Vector3(oAngle, 1, 0), Time.deltaTime * oSpeed);

oAngle is the angle I want, oSpeed just a number to easily regulate the speed that the object is moving. Is there a way to do this without a complex trig function?

more ▼

asked May 30 '10 at 02:19 AM

aLucidWorld gravatar image

aLucidWorld
67 14 14 22

you can copy the mouse orbit script in standard assets and replace the mouse input for your angle

May 30 '10 at 02:26 AM spinaljack

I swapped out the 'Input.GetAxis("Mouse X") and "y" values with numbers but nothing seemed to happen when I attached the script to the object I want to move on the 45 degree angle.

May 30 '10 at 03:44 AM aLucidWorld

got it working... I forgot to set the Transform Target for the script. Thanks for the help!

May 30 '10 at 04:10 AM aLucidWorld

Thought I had it working, I didn't. Here's a link to my script. If someone could help me with this I would greatly appreciate it. All I need for variables is an orbit speed (already set) and the angle to orbit. http://www.epicarc.com/Orbit.js

May 30 '10 at 04:39 AM aLucidWorld
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

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

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1095
x727
x288
x49

asked: May 30 '10 at 02:19 AM

Seen: 1309 times

Last Updated: May 30 '10 at 02:19 AM