3 private float m_SpeedMultiplier = 1.0;
5 private float m_SendUpdateAcc = 0.0;
12 override void EOnFrame(
IEntity other,
float timeSlice)
14 if (
GetUApi().GetInputByID(UACarShiftGearUp).LocalPress())
15 m_SpeedMultiplier = m_SpeedMultiplier + 2;
16 if (
GetUApi().GetInputByID(UACarShiftGearDown).LocalPress())
17 m_SpeedMultiplier = m_SpeedMultiplier - 2;
19 float speed = 5.0 * m_SpeedMultiplier;
20 if (
GetUApi().GetInputByID(UATurbo).LocalValue())
23 float forward =
GetUApi().GetInputByID(UAMoveForward).LocalValue() -
GetUApi().GetInputByID(UAMoveBack).LocalValue();
24 float strafe =
GetUApi().GetInputByID(UAMoveRight).LocalValue() -
GetUApi().GetInputByID(UAMoveLeft).LocalValue();
26 vector direction = GetDirection();
30 vector forwardChange = forward * timeSlice * direction * speed;
31 vector strafeChange = strafe * timeSlice * directionAside * speed;
32 vector newPos = oldPos + forwardChange + strafeChange;
33 float yMin =
GetGame().SurfaceRoadY(newPos[0], newPos[2]);
39 float yawDiff =
GetUApi().GetInputByID(UAAimLeft).LocalValue() -
GetUApi().GetInputByID(UAAimRight).LocalValue();
40 float pitchDiff =
GetUApi().GetInputByID(UAAimDown).LocalValue() -
GetUApi().GetInputByID(UAAimUp).LocalValue();
42 vector newOrient = oldOrient;
43 newOrient[0] = newOrient[0] -
Math.RAD2DEG * yawDiff * timeSlice;
44 newOrient[1] = newOrient[1] -
Math.RAD2DEG * pitchDiff * timeSlice;
45 if (newOrient[1] < -89)
47 if (newOrient[1] > 89)
50 SetOrientation(newOrient);
52 if (m_SendUpdateAcc > 0.5)
54 GetGame().UpdateSpectatorPosition(newPos);
58 m_SendUpdateAcc = m_SendUpdateAcc + timeSlice;