# [Request] Car behaviour Is Drifting Condition

Discussion and feedback on Construct 2

### » Wed Dec 18, 2013 1:44 pm

Hello all,

I was working on my LD28 entry post-compo version, which uses car behaviour as core mechanic. At this point I noticed car behaviour does not have "is drifting" condition, and similarly "is accelerating, is breaking" conditions. The latter two are easier to check via events, but is drifting requires a more subtle touch.

I imagine this can be useful in car racing games as well, especially when playing skidding tyre effects.

Meanwhile, I am open to suggestions of how to do it via events. Thanks :)
B
18
S
4
G
1
Posts: 332
Reputation: 3,149

### » Wed Dec 18, 2013 8:44 pm

try if speed is greater than x and is turning hope that'll work
B
43
S
11
G
8
Posts: 514
Reputation: 10,291

### » Wed Dec 18, 2013 9:05 pm

@sosensible, yep, I manually added IsTurning and tried to use it in a check, and it's working to a point... However, even when turning ends, drifting can continue for a varying duration set by drift recovery property. So even after the turning ends, it still keeps drifting and it doesn't work that way.

What I have to do is to check that even when the turning is ended, the object is still moving perpendicular to it's current target angle. i.e I have to catch the change in the X/Y direction that should not be happening. My math is very limited, if someone can help that would be great. But I still believe isDrifting can be very useful.
B
18
S
4
G
1
Posts: 332
Reputation: 3,149

### » Wed Dec 18, 2013 10:02 pm

Drifting is just the angle of motion catching up to the angle of the object. If you check to see if the players angle is not equal to the player's moving angle, and speed is greater than 0, that should do it.
B
67
S
21
G
8
Posts: 341
Reputation: 12,560

### » Wed Dec 18, 2013 11:35 pm

@zatyka that sounds terribly easy, will try it tomorrow (I need to set up the moving angle thing myself as the car behaviour does not have moving angle condition either) and let you know if it works :)

Thanks.
B
18
S
4
G
1
Posts: 332
Reputation: 3,149

### » Thu Dec 19, 2013 3:07 pm

The car behavior has a moving angle expression.

Object.Car.MovingAngle
B
67
S
21
G
8
Posts: 341
Reputation: 12,560