how can i set turret position in this example

Get help using Construct 2

Post » Sat Jul 11, 2015 1:30 pm

hi
please see this capx
dropbox.com/s/qg05u1sw8ydic5i/prob.capx?dl=0
i have 72 frame of a tank rotating
i want my turret position always be in the back of the tank but i can not use imagepoints as you can see (it is so bad when i use imgepoints and turrets not always in the same place ) that must be so acurate to work and doing that for 72 frames and alot of objcts like that is not an option
so i need a formula
please help .. !
B
16
S
6
Posts: 243
Reputation: 1,755

Post » Sat Jul 11, 2015 6:10 pm

no one know that ?!?!?!?!?!?
my project almost done i just stuck with this !
any suggestion?!
B
16
S
6
Posts: 243
Reputation: 1,755

Post » Sat Jul 11, 2015 7:19 pm

if i know how to move an object in a isometric circle then i can solve that !
any one can help ?
B
16
S
6
Posts: 243
Reputation: 1,755

Post » Wed Jul 22, 2015 9:17 pm

With the truck facing right the offset of the turret to the truck is (-13,-8).

Then you can set the position with
turret.x = truck.x -13*cos(360/72*truck.animationFrame)
turret.y = truck.y -8 -13*ratio*sin(360/72*truck.animationFrame)

Now "ratio" is the ratio from the visual height to the visual width of a isometric square. Depending on the angle of the isometric projection the ratio will be different. I was expecting 0.5, which is 26.5 for degree, but that didn't look right. So I measured the roof of the truck at 0 and 90 degrees. It was 8 pixels wide at 0 degrees and 22 pixels at 90, so the ratio is 8/22 or 0.36, so the angle is 20 degrees.

So you could write it like this:
turret.x = truck.x -13*cos(360/72*truck.animationFrame)
turret.y = truck.y -8 -13*tan(20)*sin(360/72*truck.animationFrame)
B
92
S
32
G
107
Posts: 5,274
Reputation: 69,959


Return to How do I....?

Who is online

Users browsing this forum: Exabot [Bot], FacuLNF and 71 guests