Code:
// lets exend SVehicle and make our own custom vehicle class
class alfa8cfinal extends SVehicle;
var() name CameraTag; //declare variable for camera attach point
//code section for camera
simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
{
local vector SocketLoc;
local rotator SocketRot;
local rotator Rot;
//get the location and rotation of the socket
Mesh.GetSocketWorldLocationAndRotation(CameraTag, SocketLoc, SocketRot);
// combine orientaton of socket with the mouse orientation
Rot.Yaw = SocketRot.Yaw + Controller.Rotation.Yaw;
Rot.Roll = SocketRot.Roll;
Rot.Pitch = SocketRot.Pitch + Controller.Rotation.Pitch;
// output transforms
out_CamLoc = SocketLoc;
out_CamRot = Rot;
return true;
}
simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
{
local vector X, Y, Z;
//this makes the camera stay with the vehicle
GetActorEyesViewPoint( out_CamLoc, out_CamRot );
GetAxes(Rotation,X,Y,Z);
// a bit behind
out_CamLoc = Location - 400 * X;
//up a bit
out_CamLoc.Z = Location.Z + 200;
//camera rotation yaw = vehicle rotation yaw
out_CamRot.Yaw = Rotation.Yaw;
// look down a bit
out_CamRot.Pitch = (-22.0f *DegToRad) * RadToUnrRot;
//delete this line if you want the cam to roll with the vehicle
out_CamRot.Roll = 0;
return true;
}
defaultproperties
{
// parameters for player to flip vehicle
UprightLiftStrength=280.0
UprightTime=1.25
UprightTorqueStrength=500.0
bCanFlip=true
bHasHandbrake=true
GroundSpeed=1500 // max speed on ground
AirSpeed=1700 // max speed in air
HeavySuspensionShiftPercent=0.75f;
// define the vehicle simulation
Begin Object Class=UDKVehicleSimCar Name=SimObject
WheelSuspensionStiffness=80.0 //how soft the suspension is
WheelSuspensionDamping=3.0
WheelSuspensionBias=0.1
ChassisTorqueScale=0.0
MaxBrakeTorque=5.0
StopThreshold=100
MaxSteerAngleCurve=(Points=((InVal=0,OutVal=45),(InVal=600.0,OutVal=15.0),(InVal=1100.0,OutVal=10.0),(InVal=1300.0,OutVal=6.0),(InVal=1600.0,OutVal=1.0)))
SteerSpeed=110
LSDFactor=0.0
// The follow two parameters set the gear rangers (in rpm) and the torque produced per range
TorqueVSpeedCurve=(Points=((InVal=-600.0,OutVal=0.0),(InVal=-300.0,OutVal=80.0),(InVal=0.0,OutVal=130.0),(InVal=950.0,OutVal=130.0),(InVal=1050.0,OutVal=10.0),(InVal=1150.0,OutVal=0.0)))
EngineRPMCurve=(Points=((InVal=-500.0,OutVal=2500.0),(InVal=0.0,OutVal=500.0),(InVal=549.0,OutVal=3500.0),(InVal=550.0,OutVal=1000.0),(InVal=849.0,OutVal=4500.0),(InVal=850.0,OutVal=1500.0),(InVal=1100.0,OutVal=5000.0)))
EngineBrakeFactor=0.025
ThrottleSpeed=0.2
WheelInertia=0.2
NumWheelsForFullSteering=4
SteeringReductionFactor=0.0
SteeringReductionMinSpeed=1100.0
SteeringReductionSpeed=1400.0
bAutoHandbrake=true
bClampedFrictionModel=true
FrontalCollisionGripFactor=0.18
ConsoleHardTurnGripFactor=1.0
HardTurnMotorTorque=0.7
SpeedBasedTurnDamping=20.0
AirControlTurnTorque=40.0
InAirUprightMaxTorque=15.0
InAirUprightTorqueFactor=-30.0
// Longitudinal tire model based on 10% slip ratio peak
WheelLongAsymptoteSlip=2.0
WheelLongAsymptoteValue=0.6
// Lateral tire model based on slip angle (radians)
WheelLatExtremumSlip=0.35 // 20 degrees
WheelLatExtremumValue=0.9
WheelLatAsymptoteSlip=1.4 // 80 degrees
WheelLatAsymptoteValue=0.9
bAutoDrive=false
AutoDriveSteer=0.3
End Object
SimObj=SimObject
Components.Add(SimObject)
Begin Object Class=AudioComponent Name=ScorpionEngineSound
SoundCue=SoundCue'A_Vehicle_Scorpion.SoundCues.A_Vehicle_Scorpion_EngineLoop'
End Object
EngineSound=ScorpionEngineSound
Components.Add(ScorpionEngineSound);
Begin Object Class=AudioComponent Name=ScorpionTireSound
SoundCue=SoundCue'A_Vehicle_Generic.Vehicle.VehicleSurface_TireDirt01Cue'
End Object
TireAudioComp=ScorpionTireSound
Components.Add(ScorpionTireSound);
TireSoundList(0)=(MaterialType=Dirt,Sound=SoundCue'A_Vehicle_Generic.Vehicle.VehicleSurface_TireDirt01Cue')
TireSoundList(1)=(MaterialType=Foliage,Sound=SoundCue'A_Vehicle_Generic.Vehicle.VehicleSurface_TireFoliage01Cue')
TireSoundList(2)=(MaterialType=Grass,Sound=SoundCue'A_Vehicle_Generic.Vehicle.VehicleSurface_TireGrass01Cue')
TireSoundList(3)=(MaterialType=Metal,Sound=SoundCue'A_Vehicle_Generic.Vehicle.VehicleSurface_TireMetal01Cue')
TireSoundList(4)=(MaterialType=Mud,Sound=SoundCue'A_Vehicle_Generic.Vehicle.VehicleSurface_TireMud01Cue')
TireSoundList(5)=(MaterialType=Snow,Sound=SoundCue'A_Vehicle_Generic.Vehicle.VehicleSurface_TireSnow01Cue')
TireSoundList(6)=(MaterialType=Stone,Sound=SoundCue'A_Vehicle_Generic.Vehicle.VehicleSurface_TireStone01Cue')
TireSoundList(7)=(MaterialType=Wood,Sound=SoundCue'A_Vehicle_Generic.Vehicle.VehicleSurface_TireWood01Cue')
TireSoundList(8)=(MaterialType=Water,Sound=SoundCue'A_Vehicle_Generic.Vehicle.VehicleSurface_TireWater01Cue')
WheelParticleEffects[0]=(MaterialType=Generic,ParticleTemplate=ParticleSystem'Envy_Level_Effects_2.Vehicle_Dust_Effects.P_Scorpion_Wheel_Dust')
WheelParticleEffects[1]=(MaterialType=Dirt,ParticleTemplate=ParticleSystem'VH_Scorpion.Effects.PS_Wheel_Rocks')
WheelParticleEffects[2]=(MaterialType=Water,ParticleTemplate=ParticleSystem'Envy_Level_Effects_2.Vehicle_Water_Effects.P_Scorpion_Water_Splash')
WheelParticleEffects[3]=(MaterialType=Snow,ParticleTemplate=ParticleSystem'Envy_Level_Effects_2.Vehicle_Snow_Effects.P_Scorpion_Wheel_Snow')
// Wheel squealing sound.
Begin Object Class=AudioComponent Name=ScorpionSquealSound
SoundCue=SoundCue'A_Vehicle_Scorpion.SoundCues.A_Vehicle_Scorpion_Slide'
End Object
SquealSound=ScorpionSquealSound
Components.Add(ScorpionSquealSound);
CollisionSound=SoundCue'A_Vehicle_Scorpion.SoundCues.A_Vehicle_Scorpion_Collide'
EnterVehicleSound=SoundCue'A_Vehicle_Scorpion.SoundCues.A_Vehicle_Scorpion_Start'
ExitVehicleSound=SoundCue'A_Vehicle_Scorpion.SoundCues.A_Vehicle_Scorpion_Stop'
SquealThreshold=0.1
SquealLatThreshold=0.02
LatAngleVolumeMult = 30.0
EngineStartOffsetSecs=2.0
EngineStopOffsetSecs=1.0
ExplosionSound=SoundCue'A_Vehicle_Scorpion.SoundCues.A_Vehicle_Scorpion_Explode'
// define the vehicle mesh, animation tree, and physics asset
Begin Object Name=SVehicleMesh
SkeletalMesh=SkeletalMesh'alfa8cpackage.alfa8cfinal'
AnimTreeTemplate=AnimTree'alfa8cpackage.AT_alfa8cfinal'
PhysicsAsset=PhysicsAsset'alfa8cpackage.alfa8cfinal_Physics'
End Object
// define all the wheels
Begin Object Class=SVehicleWheel Name=FLWheel
BoneName="Alfa_Whl_LHF"
SkelControlName="Alfa_Whl_LHF_CTRL"
WheelRadius=22
SteerFactor=1.0
LongSlipFactor=2.0
LatSlipFactor=3.0
HandbrakeLongSlipFactor=0.8
HandbrakeLatSlipFactor=0.8
End Object
Wheels(0)=FLWheel
Begin Object Class=SVehicleWheel Name=FRWheel
BoneName="Alfa_Whl_RHF"
SkelControlName="Alfa_Whl_RHF_CTRL"
WheelRadius=22
SteerFactor=1.0
LongSlipFactor=2.0
LatSlipFactor=3.0
HandbrakeLongSlipFactor=0.8
HandbrakeLatSlipFactor=0.8
End Object
Wheels(1)=FRWheel
Begin Object Class=SVehicleWheel Name=RRWheel
BoneName="Alfa_Whl_RHR"
SkelControlName="Alfa_Whl_RHR_CTRL"
WheelRadius=22
bPoweredWheel=true
End Object
Wheels(2)=RRWheel
Begin Object Class=SVehicleWheel Name=RLWheel
BoneName="Alfa_Whl_LHR"
SkelControlName="Alfa_Whl_LHR_CTRL"
WheelRadius=22
bPoweredWheel=true
End Object
Wheels(3)=RLWheel
}
Thanks in advance
Bookmarks