car
{
	name=BMW 540i Touring Steptronic
	year=2002 (E39)
	credits=BMW V8 4.4i 32V, 4398 cm³, 286hp @ 5400rpm, 440Nm @ 3600rpm
        comments=Converted by AMGfan. 0-100km/h: 6.3 s, Top: 250 km/h
	id=bmw540iT
	version=090
	wheels=4
	skid
	{
		sample=skid.wav
	}
	shadow
	{
		texture=shadow.tga
		width=2.6
		length=5
	}
	cg
	{
		x=0
		y=-0.068	;1444mm high, 38% of roof height ~ 55cm CofG
		z=0.09	;52.5/47.5% f/r
	}
	ff_factor=0.25
}

particles
{ 
backfire
{
exhaust0
{
pos=0.48 -0.32 -2.45
normal=0 0 -1
} 
type=backfire
; type=backfire_long
min_rpm=5800
; min_rpm=0
; suppose car comes from 9000 rpm for example. Then backfiring can happen when max_rpm is reached
max_rpm=6200
; high backfire likeliness for rally cars
likeliness_percentage=130
; likeliness_percentage=100
}
}

flares
{
  ; outer lamps
  flare0
  {
    pos=-0.54 0.007 2.12
    color=10 10 10   ;1.0 0.85 0.9
	normal=-0.05 0.1 0.6
	z_offset=-3000
	size_factor=0.8   ;1.2
	intensity=1.5
  }
  flare1
  {
    pos=0.54 0.007 2.12
    color=10 10 10   ;1.0 0.85 0.9
	normal=0.05 0.1 0.6
	z_offset=-3000
	size_factor=0.8   ;1.2
	intensity=1.5
  }
  flare2
  {
    pos=-0.66 0.02 2.05
    color=10 10 10   ;1.0 0.3 0.1
	normal=-0.05 0.1 0.6
	z_offset=-3000
	size_factor=0.6
	intensity=1.0
  }
  flare3
  {
    pos=0.66 0.02 2.05
    color=10 10 10   ;1.0 0.3 0.1
	normal=0.05 0.1 0.6
	z_offset=-3000
	size_factor=0.6
	intensity=1.0
  }
  flare4
  {
    pos=-0.636 -0.26 2.13
    color=10 10 10   ;1.0 0.7 0.55
	normal=-0.05 0.1 0.6
	z_offset=-3000
	size_factor=0.6
	intensity=1.0
  }
  flare5
  {
    pos=0.636 -0.26 2.13
    color=10 10 10   ;1.0 0.7 0.55
	normal=0.05 0.1 0.6
	z_offset=-3000
	size_factor=0.6
	intensity=1.0
  }
  ; Brake lights
  ; right rear
  flare6
  {
    rule=brake
    pos=-0.65 0.09 -2.36
	normal=-0.05 0 -0.5
	color=40 5 5   ;;1.0 0.0 0.0
	size_factor=1.0   ;0.8
	intensity=0.8
	z_offset=-1000
  }
  ; left rear
  flare7
  {
    rule=brake
    pos=0.65 0.09 -2.36
	normal=0.05 0 -0.5
	color=40 5 5   ;1.0 0.0 0.0
	size_factor=1.0   ;0.8
	intensity=0.8
	z_offset=-1000
  }
;3rd brakelight center top
   flare8
  {
    rule=brake
    pos=0 0.62 -1.97   ;0 0.65 -1.97
	normal=-0.05 0 -0.5
	color=40 5 5   ;1.0 0.0 0.0
	size_factor=1.0   ;1.2
	intensity=0.9   ;0.9
	z_offset=-1000
  }
  ; Rear night lights
  flare9
  {
    pos=0.41 0.1 -2.42
	normal=-0.05 0 -0.5
	color=40 40 5   ;1.0 0.2 0.0
	size_factor=0.7
	intensity=0.1   ;0.7
	z_offset=-1000
  }
  flare10
  {
    pos=-0.41 0.1 -2.42
	normal=-0.05 0 -0.5
	color=40 40 5   ;1.0 0.2 0.0
	size_factor=0.7
	intensity=0.1   ;0.7
	z_offset=-1000
  }
}

lights
{
  ; Projected lights
  light0
  {
    texture=light.tga
    ; Field of view (vertical)
    fov=65
    ; Aspect (horizontal)
    aspect=3
    ; Distance to car
    z=1.5
    ; Pitching with respect to car (in degrees)
    pitch=-2
    ; Fall-off distance
    far=300
  }
}

body
{
	x=0
	y=0
	z=0
	mass=1640	;1480kg kerb weight, -140kg unsprung +80kg driver 20kg fuel
  inertia
  {
    x=2310
    y=2810
    z=590
  }
	width=1.830
	height=1.00
	length=4.812
	manual_box=1
	model
	{
		file=540.dof
	}
	model_incar
	{
		file=540.dof
	}
	model_light_l
	{
		file=lights.dof
	}
	model_braking_l
	{
		file=brakes.dof
	}
 model_lightroad_l
 {
  file=lightsin.dof
 }
  model_reverse_l
  {
    ; Reverse gear indicators
    file=re.dof
  }
  model_reverse_r
  {
    file=re.dof
}
}

steer
{
	x=0.42
	y=0.22
	z=0.41
	xa=20
	lock=1080				
	linearity=0.3
	model
	{
		file=steer.dof
		lod0_z=0
		lod_out=2
	}
}

engine
{
	x=0
	y=0
	z=0
	size=0
	mass=220
	idle_method=1
	idle_throttle=0.05
	idle_rpm=900
	min_warn_rpm=6700
	max_warn_rpm=7000
	max_rpm=6100
	start_rpm=1300
	stall_rpm=450
	autoclutch=1
	autoclutch_rpm=
	starter=1
	starter_torque=100
	start_stalled=0   ;1
	enable_stall=1
	curve_torque=torque.crv
	max_torque=0.85
	torque_reaction=0.25
	braking_coeff=
	braking_offset=
	braking_torque_curve=braking_torque.crv
	friction=0
	cylinders=6
	cylinder_angle=90
	rumble_amplitude=
	rumble_maxrpm=
	inertia
	{
		engine=0.38
	}
	jitter
	{
		amplitude=0.1
		frequency_min=1
		frequency_var=0.1
		time_min=150
		time_var=10
	}
	shifting
	{
		automatic=1
		blip_throttle=0.3
		cut_throttle=1
		fast=1
		shift_up_rpm=6000
		shift_down_rpm=1500
		time_to_declutch=125
		time_in_neutral=225
		time_to_clutch=125
		time_to_declutch_down=125
		time_in_neutral_down=225
		time_to_clutch_down=175
	}
}

fuel
{
	bsfc=6.5e-5
	max=70
	type=0
}

;----------------------drivetrain----------------------

gearbox ;5-speed automatic ZF 5 HP 24 EH Steptronic
{
	gears=6

	gear0
	{
		ratio=-4.1
		inertia=0.02
		linearity=0.5
	}

	gear1
	{
		ratio=3.57   ;62kmh
		inertia=0.03
		linearity=1
	}

	gear2
	{
		ratio=2.2    ;101kmh
		inertia=0.04
		linearity=1.2
	}

	gear3
	{ 
		ratio=1.51   ;147kmh
		inertia=0.05
		linearity=1.4
	}

	gear4
	{
		ratio=1.00   ;222kmh
		inertia=0.06
		linearity=1.6
	}

	gear5
	{
		ratio=0.83   ;250kmh @ 5500rpm (limited)
		inertia=0.08
		linearity=1.8
	}

}

differential
{
	type=1
	ratio=3.15
	inertia=0.16
	locking_coeff=100 ;25
	output2=2
	output3=3
}

clutch
{
	max_torque=600 
}

handbrakes
{
	wheels=23
}

aero
{
	body
	{
		center=0 0 0
		cx=0.33
		area=2.03
	}
	wings=1
	wing0
	{
		name=lift
		span=1
		cord=1
		coeff_drag=0
		coeff_down=0
		center=0 0 0
		angle=0
		angle_offset=10
	}
}

antirollbar
{
	count=2
	arb0
	{
		susp_left=0
		susp_right=1
		k=41000
	}
	arb1
	{
		susp_left=2
		susp_right=3
		k=34000
	}
}

susp_front
{
	y=0.03
	z=1.44
	restlen=0.451			;293	395kg
	minlen=0.22
	maxlen=0.46
	k=27000			;@ static load and 1.316 NF SR
	bump_rate=1350		;0.7	1944
	rebound_rate=4600	;0.7	6531
	bump_function=0
	bump_max=1500
	rebound_function=0
	anti_pitch=0.1
	camber_change_per_m=0.067
	roll_center
	{
		x=0
		y=-0.552	;60mm
		z=0
	}
}

susp_rear
{
	y=0.00
	z=-1.425
	restlen=0.420			;305	275kg
	minlen=0.2
	maxlen=0.43
	k=24500			;@ static load and 1.502 NF SR
	bump_rate=1400		;0.75	1852
	rebound_rate=4200	;0.8	5191
	bump_function=0
	bump_max=1500
	rebound_function=0
	anti_pitch=0.1
	camber_change_per_m=0.14
	roll_center
	{
		x=0
		y=-0.554	;120mm
		z=0
	}
}

susp0~susp_front
{
	x=0.72
	camber_change_steering=0.147	;0.25 rad ~ 14.5 degree camber with 1 radian rotation of steering @ 8 degree caster
	caster_offset=-0.0235		;8 degrees static caster -0.0235	
	toe_change_per_m=0
}
susp1~susp_front
{
	x=-0.72
	camber_change_steering=-0.147	;0.25 rad ~ 14.5 degree camber with 1 radian rotation of steering @ 8 degree caster
	caster_offset=-0.0235		;5.78 degrees static caster -0.0235
	toe_change_per_m=0
}

susp2~susp_rear
{
	x=0.74
}
susp3~susp_rear
{
	x=-0.74
}

;----------------------tyres----------------------

tire_model_front
{
	damping_predict_lat=0
	damping_predict_long=0
}
tire_model_rear
{
	damping_predict_lat=0
	damping_predict_long=0
}
pacejka
{
	a0=1.25
	a1=-35
	a2=1200
	a3=2000
	a4=8
	a5=0.015
	a6=-0.25
	a7=0.1
	a8=-0.03
	a9=-0.001
	a10=-0.15
	a111=-8.5
	a112=-0.29
	a12=17.8
	a13=-2.4
	b0=1.5
	b1=-70
	b2=1350
	b3=20
	b4=325
	b5=0.08
	b6=0
	b7=0.05
	b8=-0.025
	b9=0
	b10=0
	b11=0
	b12=0
	c0=2.2
	c1=-4
	c2=-3
	c3=-1
	c4=-7
	c5=0.0
	c6=0.0
	c7=0.044
	c8=-0.58
	c9=0.18
	c10=0.043
	c11=0.048
	c12=-0.0035
	c13=-0.18
	c14=0.14
	c15=-1.029
	c16=0.27
	c17=-1.1

	optimal_slipratio=0.11
	optimal_slipangle=0.145
}

skidding_default
{
	long_start=0.1
	long_max=1.0
	long_start_n=0.1
	long_max_n=1.0
	lat_start=0.1
	lat_max=1.0
}

;----------------------wheels----------------------

wheel_front
{
	y=0
	z=0
	steering=1
	powered=0
	lock=50
	mass=35
	inertia=1.4
	radius=0.31715
        width=0.225		
	rolling_coeff=0.0180
	max_braking=2200 ;1500
	braking_factor=1
	tire_rate=250000
	pacejka~pacejka
	{
	}
}

wheel_rear
{
	y=0
	z=0
	steering=0
	powered=1
	mass=35
	inertia=1.35
	radius=0.31715
        width=0.225		;225/40 ZR18
	rolling_coeff=0.0180
	max_braking=800
	braking_factor=1
	max_handbrake_torque=8400
	tire_rate=230000
	pacejka~pacejka
	{
		optimal_slipratio=0.11
		optimal_slipangle=0.155
	}
}

wheel0~wheel_front
{
	x=0
	ackerman=1.15
	toe=-0
	camber=0.007	;-0.6
	model
	{
		file=lf.dof
	}
	model_brake
	{
		file=flb.dof
	}
}

wheel1~wheel_front
{
	x=0
	ackerman=1.15   ;-1.15
	toe=0
	camber=0.007
	model
	{
		file=rf.dof
	}
	model_brake
	{
		file=frb.dof
	}
}

wheel2~wheel_rear
{
	x=0
	toe=-0.21	;toe in, goes to out under bump like M3 Z axle
	camber=-0.588	;-1.5
	model
	{
		file=lf.dof
	}
	model_brake
	{
		file=flb.dof
	}
}

wheel3~wheel_rear
{
	x=0
	toe=0.21	;toe in, goes to out under bump like M3 Z axle
	camber=-0.588
	model
	{
		file=rf.dof
	}
	model_brake
	{
		file=frb.dof
	}
}

;	------------------ Artyfishul Intellygents -----------------
     
ai
{
	grip_factor=1.1
}

;	------------------ 5.1 ALPHA AUDIO COMPATABILTY -----------------

audio
{
	skid
  {
    volume=1
    smp0
    {
      volume=1.0
      sample=skid.wav
      min=0.25 ;0.1
      max=1.0
      attack=0.15
      decay=1.0
    }
    smp1
    {
      volume=1.0
      sample=skid_lon.wav
      min=1.0
      max=100.0
      attack=0.50
      decay=1.0
    }
  }
	horn
	{
		sample=Horn.wav
	}
  	shiftout
  	{
    		sample=Shift_Out.wav
  	}
	acc_all
	{
		attack=2600
		decay=2600
	}
	accelerate_out
	{
		smp0~audio.acc_all
    {
      sample=sounds\onidle_ex.wav
      volume=1
      min=1
      max=2480
      natural=1510
    }
    smp1~audio.acc_all
    {
      sample=sounds\onverylow_ex.wav
      volume=1
      min=1975
      max=3870
      natural=3000
    }
    smp2~audio.acc_all
    {
      sample=sounds\onlow_ex.wav
      volume=1
      min=3265
      max=6820 ;4820
      natural=4000
    }
    smp3~audio.acc_all
    {
      sample=sounds\onmid_ex.wav
      volume=1
      min=4262
      max=8000
      natural=5000
    }
  }
  decelerate_out
  {
    smp0~audio.acc_all
    {
      sample=sounds\idle_ex.wav
      volume=1
      min=1
      max=1772
      natural=850
    }
    smp1~audio.acc_all
    {
      sample=sounds\offverylow_ex.wav
      volume=1
      min=1183
      max=2620
      natural=2000
    }
    smp2~audio.acc_all
    {
      sample=sounds\offlow_ex.wav
      volume=1
      min=2104
      max=3500
      natural=3050
    }
    smp3~audio.acc_all
    {
      sample=sounds\offmid_ex.wav
      volume=1
      min=2985
      max=8000
      natural=6000
    }
  }
  accelerate_in
  {
    smp0~audio.acc_all
    {
      sample=sounds\onidle.wav
      volume=1
      min=1
      max=2600
      natural=1510
    }
    smp1~audio.acc_all
    {
      sample=sounds\onverylow.wav
      volume=0.8
      min=1975
      max=3870
      natural=3000
    }
    smp2~audio.acc_all
    {
      sample=sounds\onlow.wav
      volume=0.8
      min=3265
      max=5820 ;4820
      natural=4000
    }
    smp3~audio.acc_all
    {
      sample=sounds\onmid.wav
      volume=0.8
      min=4262
      max=8000
      natural=5000
    }
  }
  decelerate_in
  {
    smp0~audio.acc_all
    {
      sample=sounds\idle.wav
      volume=1
      min=1
      max=1772
      natural=850
    }
    smp1~audio.acc_all
    {
      sample=sounds\offverylow.wav
      volume=1
      min=1183
      max=2420
      natural=2000
    }
    smp2~audio.acc_all
    {
      sample=sounds\offlow.wav
      volume=1
      min=2104
      max=3500
      natural=3050
    }
    smp3~audio.acc_all
    {
      sample=sounds\offmid.wav
      volume=1
      min=2985
      max=8000
      natural=4000
    }
  }
	wind
	{
		volume=4 ;9
		pitch_scale=1
		pitch_offset=30
		smp0
		{
			sample=Wind1.wav
			min=5
			max=6
			attack=33
			decay=33
			natural=80
		}
		smp1
		{
			sample=Wind2.wav
			min=30
			max=31
			attack=33
			decay=33
			natural=80
		}
		smp2
		{
			sample=Wind3.wav
			min=55
			max=56
			attack=33
			decay=33
			natural=80
		}
	}
}



;----------------------driving aids----------------------
abs
{
  enable=1
  max_velocity_ratio=1.09 
  min_velocity_ratio=1.08
  min_velocity=1
}
traction_control
{
  	enable=1
  	min_velocity=1.667
  	max_velocity_ratio=1.050
  	min_velocity_ratio=1.300

}
;---------------------------------------------
;Cameras
;---------------------------------------------

camera0
{
  name=Driver
  fov=70
  model=1
  wheels=0
  view=1
  offset
  {
    x=0.42
    y=0.48
    z=-0.06
  }
  offset_to
  {
    x=0.38
    y=-0.2
    z=10
  }
  src
  {
    mass=1
    k=250
    damping=25
    maxdist=0
  }
  dst
  {
    mass=1
    k=0
    damping=0
    maxdist=0
  }
}
camera1
{
  name=Driver, left
  fov=60
  model=1
  wheels=0
  view=1
  offset
  {
    x=0.42
    y=0.47
    z=-0.031
  }
  offset_to
  {
    x=10.43
    y=0.5
    z=10
  }
  src
  {
    mass=1
    k=250
    damping=25
    maxdist=0
  }
  dst
  {
    mass=1
    k=0
    damping=0
    maxdist=0
  }
}
camera2
{
  name=Driver, right
  fov=60
  model=1
  wheels=0
  view=1
  offset
  {
    x=0.42
    y=0.47
    z=-0.031
  }
  offset_to
  {
    x=-9.57
    y=0.5
    z=10
  }
  src
  {
    mass=1
    k=250
    damping=25
    maxdist=0
  }
  dst
  {
    mass=1
    k=0
    damping=0
    maxdist=0
  }
}
camera3
{
  name=Driver, rear
  fov=-65
  model=0
  wheels=0
  view=0
  offset
  {
    x=0.2
    y=0.5
    z=-0.23
  }
  offset_to
  {
    x=-1
    y=0.5
    z=-10
  }
  src
  {
    mass=1
    k=250
    damping=25
    maxdist=0
  }
  dst
  {
    mass=1
    k=0
    damping=0
    maxdist=0
  }
}
camera4
{
  name=Chase
  fov=60
  model=0
  wheels=0
  view=0
  offset
  {
    x=0
    y=-0.5
    z=-5
  }
  follow
  {
    pitch=0
    yaw=1
    roll=0
  }
  angle
  {
    x=15
    y=180
    z=0
  }
}
camera5
{
  name=Exterior
  fov=60
  model=0
  view=0
  wheels=0
  follow
  {
    pitch=0
    yaw=0
    roll=0
  }
  offset
  {
    x=0
    y=-0.5
    z=-5
  }
  angle
  {
    x=10
    y=130
    z=0
  }
}
camera6
{
  name=Rear chase
  fov=60
  model=0
  view=0
  wheels=0
  follow
  {
    pitch=0
    yaw=1
    roll=0
  }
  offset
  {
    x=0
    y=-0.8
    z=-6
  }
  angle
  {
    x=10
    y=0
    z=0
  }
}
camera7
{
  name=FrontWheel
  fov=60
  model=0
  view=0
  wheels=0
  follow
  {
    pitch=1
    yaw=1
    roll=1
  }
  offset
  {
    x=1.15
    y=0.06
    z=-2.5
  }
  angle
  {
    x=-2.25
    y=-161
    z=3.3
  }
}
camera8
{
  name=Far
  fov=20
  model=0
  view=0
  wheels=0
  follow
  {
    pitch=0
    yaw=0
    roll=0
  }
  offset
  {
    x=0
    y=-0.5
    z=-20
  }
  angle
  {
    x=10
    y=50
    z=0
  }
}
camera9
{
  name=Hood
  fov=60
  model=0
  wheels=0
  view=0
  follow
  {
    pitch=1
    yaw=1
    roll=1
  }
  offset
  {
    x=0
    y=-0.7
    z=0.9
  }
  angle
  {
    x=5
    y=180
    z=0
  }
}