# Car Behavior turning speed = different soudfx?

Get help using Construct 2

### » Sat May 28, 2016 5:22 am

I have a player that's controlled y the computer using the Car behavior. The car can turn at different speeds depending on the type of corner it is on, therefore acting as if it's being operated by an analog gamepad rather than a digital keyboard (where the turn speed is fixed). Is there a way of measuring how fast the car is turning, ad be able to assign different "screech" soundfx? A slow, gentle turn has a miniscreech, a full push of the joystick give a huge screen, etc?
B
41
S
12
G
14
Posts: 1,124
Reputation: 11,286

### » Tue May 31, 2016 3:40 pm

You have to have different sound files for each type of screech. Then measure the angle of turn (or maybe the rate of angular turning) and play the different sound files for each subset of action.
https://www.ravenheart.ca/home
I don't check the forums much anymore, but I will receive an email for PMs.

"Someone once told me I bite off more than I can chew...

I told them I would rather choke on greatness than nibble on mediocrity."
B
23
S
6
G
1
Posts: 1,419
Reputation: 4,867

### » Tue May 31, 2016 5:28 pm

gumshoe2029 wrote:You have to have different sound files for each type of screech. Then measure the angle of turn (or maybe the rate of angular turning) and play the different sound files for each subset of action.

Yeah, can the rate of the turn be measured, independently from the speed of the car?
B
41
S
12
G
14
Posts: 1,124
Reputation: 11,286

### » Tue May 31, 2016 6:22 pm

global number rateOfTurn=0
global number previousAngle=0

everytick
--- set rateOfTurn to (sprite.angle-previousAngle)/dt
--- set previousAngle to sprite.angle
B
100
S
38
G
134
Posts: 5,556
Reputation: 85,325

### » Thu Jun 02, 2016 5:05 am

R0J0hound wrote:global number rateOfTurn=0
global number previousAngle=0

everytick
--- set rateOfTurn to (sprite.angle-previousAngle)/dt
--- set previousAngle to sprite.angle

Thanks! This seems to increase as the cars speed increases, is there a way to subtract the cars speed changes from the turn speed?
B
41
S
12
G
14
Posts: 1,124
Reputation: 11,286

### » Thu Jun 02, 2016 1:25 pm

R0J0hound wrote:global number rateOfTurn=0
global number previousAngle=0

everytick
--- set rateOfTurn to (sprite.angle-previousAngle)/dt
--- set previousAngle to sprite.angle

Trying again, this seems to increase as the cars speed increases, but the rate of turn appears to be the same, no matter how fast the car turns?
B
41
S
12
G
14
Posts: 1,124
Reputation: 11,286

### » Thu Jun 02, 2016 5:54 pm

Nothing comes to mind. Reading your initial post maybe you can make the sound depend of the joystick instead of the turning rate?
B
100
S
38
G
134
Posts: 5,556
Reputation: 85,325

### » Thu Jun 02, 2016 9:11 pm

R0J0hound wrote:Nothing comes to mind. Reading your initial post maybe you can make the sound depend of the joystick instead of the turning rate?

The car is computer driven, so maybe that has something to do with it :/ Can the amount of angles changed per second be calculated somehow?
B
41
S
12
G
14
Posts: 1,124
Reputation: 11,286

### » Thu Jun 02, 2016 10:52 pm

Zebbi wrote:This seems to increase as the cars speed increases, is there a way to subtract the cars speed changes from the turn speed?

Besides that, i dont think that is what you need. You need to know the resistance to Inertia.

When the frontwheels are alligend with the cars angle, there is no squealing. When they differend a lot, it means the tires try to go a differend path then the car. Depending on the grip, they will squealing.

I think you have to compare the Sprite.angle with Sprite.Car.MovingAngle. Probaly have to abs it. How bigger the difference how more squealing should happen. Got to account for the ground/grip with a factor.
B
33
S
18
G
29
Posts: 2,493
Reputation: 21,450