Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 |
class VehicleMotor extends Motor native; var Vehicle vehicle; var vector currentSteering; cpptext { static const float RADIANS_TO_UNREAL; virtual void driveVehicle(const FVector& steering, const FVector& direction); virtual void stop(); virtual void rotateToward(const FVector& target); } // construct overloaded simulated function construct(actor Owner, optional optional name Tag, optional vector Location, optional rotator Rotation) { super.construct(owner, tag, location, rotation); vehicle = Vehicle(Owner); if (vehicle == None) { warn("VehicleMotor's owner is not a vehicle"); } } function driveVehicle(float inForward, float inStrafe, rotator directionRotation, bool inThrust, bool inDive) { // apply input to vehicle input parameters // ... throttle if (InForward > 1) vehicle.ThrottleInput = 1; else if(InForward < -1) vehicle.ThrottleInput = -1; else vehicle.ThrottleInput = 0; // ... strafe if (InStrafe < -1) vehicle.StrafeInput = 1; else if(InStrafe > 1) vehicle.StrafeInput = -1; else vehicle.StrafeInput = 0; // ... rotation vehicle.RotationInput = directionRotation; vehicle.RotationInput = normalize(vehicle.RotationInput); vehicle.RotationInput.Pitch = clamp(vehicle.RotationInput.Pitch, vehicle.driverMinimumPitch, vehicle.driverMaximumPitch); vehicle.controller.setRotation(vehicle.RotationInput); // ... thrust if (inThrust) vehicle.ThrustInput = 1; else vehicle.ThrustInput = 0; // ... dive vehicle.DiveInput = inDive; } function displayWorldSpaceDebug(HUD displayHUD) { local color workColor; workColor.R = 255; workColor.G = 0; workColor.B = 0; // steering if (currentSteering != vect(0,0,0)) displayHud.draw3DLine(vehicle.location, vehicle.location + currentSteering * 3, workColor); } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |