Physics - variable speed limits

Get help using Construct 2

» Wed Jan 09, 2013 5:38 pm

@Geometrix, no worries. I recognised the "stuck in a loop" grey box from stuff I was doing last night ;p
B
15
S
5
G
7
Posts: 877
Reputation: 5,650

» Wed Jan 09, 2013 5:58 pm

If you calculate what the speed will be after applying the impulse, then you can compare the current speed with the calculated speed.

If either of these is true then apply the force:
[code]+calculated speed<max speed

+calculated speed>=max speed
+calculated speed<current speed[/code]
To calculate the speed take the same value used for applying impulse and do this:
vx= self.Physics.VelocityX+IMPULSE/self.Physics.Mass*cos(self.Angle)
vy= self.Physics.VelocityY+IMPULSE/self.Physics.Mass*sin(self.Angle)
calculated speed= distance(0,0,vx,vy)

I made my own capx to figure out a solution so here it is for a working example:
http://dl.dropbox.com/u/5426011/examples16/spaceship.capx
B
79
S
24
G
54
Posts: 4,746
Reputation: 40,755

» Wed Jan 09, 2013 6:20 pm

^ that's exactly what I was going to say! (yeah right) ;)
B
15
S
5
G
7
Posts: 877
Reputation: 5,650

» Wed Jan 09, 2013 8:03 pm

@R0J0hound, you're a legend. Thanks mate, that worked perfectly. Also managed to solve my crude workaround that required linear damping on the regular thrusters, so cheers!
B
56
S
15
G
10
Posts: 910
Reputation: 11,952

» Wed Jan 09, 2013 10:03 pm

@Auntie Val , Yeah , But I was here for more than a lot of time !
So ... You see ...
B
35
S
16
G
16
Posts: 2,222
Reputation: 16,589

» Wed Jan 09, 2013 10:50 pm

@ Whiteclaws

No Kiddo,
Looks like you don't see.

B
20
S
2
Posts: 257
Reputation: 2,431

Previous