# Move an object while it is rotating

**URL:** https://forum.kirupa.com/t/move-an-object-while-it-is-rotating/259678
**Category:** Uncategorized
**Created:** [May 7, 2008, 6:47pm UTC](https://forum.kirupa.com/t/move-an-object-while-it-is-rotating/259678 "2008-05-07T18:47:28Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![RebuiltJorge](https://avatars.discourse-cdn.com/v4/letter/r/94ad74/32.png) [@RebuiltJorge](https://forum.kirupa.com/u/RebuiltJorge)
#### Post date: [May 7, 2008, 6:47pm UTC](https://forum.kirupa.com/t/move-an-object-while-it-is-rotating/259678/1 "2008-05-07T18:47:28Z")

</div>

Hi, I have have two objects: one is a **spaceship** and the other is a **ball** that rotates around the spaceship (shield). I want to be able to press a button have ball move forward (while still rotating), the code I used for the ball rotation is

function moveFireAround(evt:Event) {  
evt.target.x = reallyThisObject.x; //reallyThisObject is the ship  
evt.target.y = reallyThisObject.y;  
radian = angle \* (Math.PI/180);  
evt.target.x = reallyThisObject.x + radius \* Math.cos(radian);  
evt.target.y = reallyThisObject.y + radius \* Math.sin(radian);  
angle+= angleChange;  
}

This works fine of course, but I’m having a hard time moving the ball forward while simultaneously rotating, any ideas?  
Thanks

---

<div class="post-metadata">

### Author: ![RebuiltJorge](https://avatars.discourse-cdn.com/v4/letter/r/94ad74/32.png) [@RebuiltJorge](https://forum.kirupa.com/u/RebuiltJorge)
#### Post date: [May 9, 2008, 11:20am UTC](https://forum.kirupa.com/t/move-an-object-while-it-is-rotating/259678/2 "2008-05-09T11:20:20Z")

</div>

ok thanks
