RickiKicks
New member
- Joined
- Oct 27, 2009
- Messages
- 1
I am a programmer trying to program a 2-dimensional game based on space exploration. My memory for retaining math formulas suck and I am sure most of you aren't programmers so I'll try to explain what I am attempting to do with out a screen cap. The space ship represents the center of the circle and it has an arm with a grapple at the end to pick things up. When the user picks something up with it and rotates the ship, I want to make sure that what ever is picked up stays infront of the ship at the exact distance it was picked up at. I know basically what to use to figure this out. This is the formula i am using:
this is the variable that holds the rotation of the ship:
tempAngle = shipRotation*PI/180;
a satellite is one of the interactable objects with this grapple, ._x is the horizontal pixel location on the screen, and ._y is the vertical, 400 is the center of the program(and the ship) on the horizontal and 300 is the vertical center. The key thing is, I don't know what value to multiply the sin and cos of the angle of rotation with to figure out how to keep the satellite along the circumference of the ship's grapple(technically the radius of the circle). I know the radius of the circle and the pre-existing location of the satellite before I try to rotate the ship, the closest fake-math I could get keeps it infront of the ship but it follows in some oval-shaped circumference
Satellite._x = 400+cos(tempAngle)*?
Satellite._y = 300+sin(tempAngle)*?
thank you for any help ^_^
this is the variable that holds the rotation of the ship:
tempAngle = shipRotation*PI/180;
a satellite is one of the interactable objects with this grapple, ._x is the horizontal pixel location on the screen, and ._y is the vertical, 400 is the center of the program(and the ship) on the horizontal and 300 is the vertical center. The key thing is, I don't know what value to multiply the sin and cos of the angle of rotation with to figure out how to keep the satellite along the circumference of the ship's grapple(technically the radius of the circle). I know the radius of the circle and the pre-existing location of the satellite before I try to rotate the ship, the closest fake-math I could get keeps it infront of the ship but it follows in some oval-shaped circumference
Satellite._x = 400+cos(tempAngle)*?
Satellite._y = 300+sin(tempAngle)*?
thank you for any help ^_^