IVehicleMovement

Interface for vehicle movement class

C++
struct IVehicleMovement : public IMovementController {
  enum EVehicleMovementType {
    eVMT_Sea = 0,
    eVMT_Air,
    eVMT_Land,
    eVMT_Amphibious,
    eVMT_Walker,
    eVMT_Dummy,
    eVMT_Other
  };
  enum EVehicleMovementEvent {
    eVME_Damage = 0,
    eVME_DamageSteering,
    eVME_VehicleDestroyed,
    eVME_Repair,
    eVME_TireBlown,
    eVME_TireRestored,
    eVME_PlayerEnterLeaveSeat,
    eVME_PlayerEnterLeaveVehicle,
    eVME_PlayerSwitchView,
    eVME_Collision,
    eVME_GroundCollision,
    eVME_WarmUpEngine,
    eVME_ToggleEngineUpdate,
    eVME_BecomeVisible,
    eVME_SetMode,
    eVME_Turbulence,
    eVME_NW_Discharge,
    eVME_EnableHandbrake,
    eVME_PartDetached,
    eVME_SetFactorMaxSpeed,
    eVME_SetFactorAccel,
    eVME_StoodOnChange,
    eVME_Others
  };
};
File

IVehicleSystem.h

Description

Interface used to implement a movement class for vehicles.

IVehicleMovement::EVehicleMovementEvent Enumeration

Event values for the movement

C++
enum EVehicleMovementEvent {
  eVME_Damage = 0,
  eVME_DamageSteering,
  eVME_VehicleDestroyed,
  eVME_Repair,
  eVME_TireBlown,
  eVME_TireRestored,
  eVME_PlayerEnterLeaveSeat,
  eVME_PlayerEnterLeaveVehicle,
  eVME_PlayerSwitchView,
  eVME_Collision,
  eVME_GroundCollision,
  eVME_WarmUpEngine,
  eVME_ToggleEngineUpdate,
  eVME_BecomeVisible,
  eVME_SetMode,
  eVME_Turbulence,
  eVME_NW_Discharge,
  eVME_EnableHandbrake,
  eVME_PartDetached,
  eVME_SetFactorMaxSpeed,
  eVME_SetFactorAccel,
  eVME_StoodOnChange,
  eVME_Others
};
File

IVehicleSystem.h

Members
Members
Description
eVME_Damage = 0
the vehicle got hit and the movement should be damaged according to the value which got passed
eVME_DamageSteering
the vehicle got hit and the movement steering should fail according to the value which got passed
eVME_Repair
Repair event. New damage ratio is passed.
eVME_TireBlown
tire destroyed
eVME_TireRestored
tires restored
eVME_PlayerEnterLeaveSeat
sent when player enters/leaves seat
eVME_PlayerEnterLeaveVehicle
sent when player enters/leaves the vehicle
eVME_PlayerSwitchView
sent when player switches view
eVME_Collision
sent on collision
eVME_GroundCollision
sent on ground collision
eVME_WarmUpEngine
?
eVME_ToggleEngineUpdate
sent when vehicle toggles engine update slot
eVME_BecomeVisible
becoming visible
Description

All event type possible to be sent to a movement.

IVehicleMovement::EVehicleMovementType Enumeration
C++
enum EVehicleMovementType {
  eVMT_Sea = 0,
  eVMT_Air,
  eVMT_Land,
  eVMT_Amphibious,
  eVMT_Walker,
  eVMT_Dummy,
  eVMT_Other
};
File

IVehicleSystem.h

IVehicleMovement::DisableEngine Method

Enables/disables engine's ability to start

C++
virtual void DisableEngine(bool disable) = 0;
IVehicleMovement::EnableMovementProcessing Method

Enables/disables movement processing

C++
virtual void EnableMovementProcessing(bool enable) = 0;
Description

This allows disabling of the actual movement processing, while still have the engine running and process driver input, effects, etc. Useful for trackview sequences

IVehicleMovement::GetDamageRatio Method

Returns the damage ratio of the engine

C++
virtual float GetDamageRatio() = 0;
Returns

The damage ratio

Description

Used to receive the damage ratio of the movement. The damage ratio of the movement may not reflect the damage ratio of the vehicle. The value is between 0 and 1.

IVehicleMovement::GetMemoryUsage Method
C++
virtual void GetMemoryUsage(ICrySizer * s) const = 0;
IVehicleMovement::GetMovementActions Method
C++
virtual SVehicleMovementAction GetMovementActions() = 0;
IVehicleMovement::GetMovementState Method
C++
virtual void GetMovementState(SMovementState& movementState) = 0;
Description

Fetch the current movement state of the entity

IVehicleMovement::GetMovementType Method

Get movement type

C++
virtual EVehicleMovementType GetMovementType() = 0;
IVehicleMovement::GetNetworkLock Method
C++
virtual CryCriticalSection* GetNetworkLock() = 0;
IVehicleMovement::GetPhysicalizationType Method
C++
virtual pe_type GetPhysicalizationType() const = 0;
IVehicleMovement::GetStatus Method

Get a vehicle status, Can return 0 on failure as different vehicle movements will support different status information

C++
virtual int GetStatus(SVehicleMovementStatus* status) = 0;
IVehicleMovement::GetVehicleNetState Method
C++
virtual SVehicleNetState GetVehicleNetState() = 0;
IVehicleMovement::GetWheelContacts Method

Gets number of wheel contacts, 0 if n/a

C++
virtual int GetWheelContacts() const = 0;
IVehicleMovement::Init Method

Initializes the movement

C++
virtual bool Init(IVehicle* pVehicle, const CVehicleParams& table) = 0;
Parameters
Parameters
Description
IVehicle* pVehicle
pointer to the vehicle which will uses this movement instance
const CVehicleParams& table
table which hold all the movement parameters
Description

Used to initialize a movement from a script table.

IVehicleMovement::IsMovementProcessingEnabled Method
C++
virtual bool IsMovementProcessingEnabled() = 0;
IVehicleMovement::IsPowered Method
C++
virtual bool IsPowered() = 0;
IVehicleMovement::OnAction Method
C++
virtual void OnAction(const TVehicleActionId actionId, int activationMode, float value) = 0;
IVehicleMovement::OnEvent Method

Sends an event message to the vehicle movement

C++
virtual void OnEvent(EVehicleMovementEvent event, const SVehicleMovementEventParams& params) = 0;
Parameters
Parameters
Description
EVehicleMovementEvent event
event to be passed to the movement
const SVehicleMovementEventParams& params
event parameters, e.g. damage value
Description

Used by various code module of the vehicle system to notify the movement code of any appropriate change. A list of all the supported event can be found in the EVehicleMovementEvent enum.

IVehicleMovement::Physicalize Method

Change physicalization of the vehicle.

C++
virtual void Physicalize() = 0;
IVehicleMovement::PostInit Method

PostInit, e.g. for things that need full physicalization

C++
virtual void PostInit() = 0;
IVehicleMovement::PostPhysicalize Method

Post - physicalize.

C++
virtual void PostPhysicalize() = 0;
IVehicleMovement::PostSerialize Method
C++
virtual void PostSerialize() = 0;
IVehicleMovement::PostUpdateView Method

Allows updates by the movement system after the view has updated

C++
virtual void PostUpdateView(SViewParams & viewParams, EntityId playerId) = 0;
Parameters
Parameters
Description
SViewParams & viewParams
structure which is used to return the camera info
EntityId playerId
entity id of the passenger
Description

Optionally update the SViewParams structure will additional camera information

IVehicleMovement::ProcessEvent Method
C++
virtual void ProcessEvent(SEntityEvent& event) = 0;
IVehicleMovement::ProcessMovement Method

Updates all physics related to the movement

C++
virtual void ProcessMovement(const float deltaTime) = 0;
Parameters
Parameters
Description
const float deltaTime
time in seconds of the update
Description

Will update the vehicle movement for a specified frame time. Unlike the Update function also present on the movement interface, this function is called from a callback function in CryPhysics rather than from IVehicle::Update. It's usually called at fixed interval and much more often than the Update function. This should only be used to update physics related attributes of the vehicle.

IVehicleMovement::RegisterActionFilter Method
C++
virtual void RegisterActionFilter(IVehicleMovementActionFilter* pActionFilter) = 0;
IVehicleMovement::Release Method

Releases the movement

C++
virtual void Release() = 0;
IVehicleMovement::RequestActions Method
C++
virtual void RequestActions(const SVehicleMovementAction& movementAction) = 0;
IVehicleMovement::RequestMovement Method
C++
virtual bool RequestMovement(CMovementRequest& movementRequest) = 0;
Description

Request some movement; If the request cannot be fulfilled, returns false, and request is updated to be a similar request that could be fulfilled (calling code is then free to inspect this, and call RequestMovement again to set a new movement)

IVehicleMovement::Reset Method

Resets the movement

C++
virtual void Reset() = 0;
IVehicleMovement::ResetInput Method

Resets any input previously active in the movement

C++
virtual void ResetInput() = 0;
IVehicleMovement::Serialize Method
C++
virtual void Serialize(TSerialize ser, EEntityAspects aspects) = 0;
IVehicleMovement::SetAuthority Method
C++
virtual void SetAuthority(bool auth) = 0;
IVehicleMovement::SetVehicleNetState Method
C++
virtual void SetVehicleNetState(const SVehicleNetState& state) = 0;
IVehicleMovement::StartDriving Method

The vehicle has started being driven.

C++
virtual bool StartDriving(EntityId driverId) = 0;
Description

Called when the vehicle gets a new driver.

IVehicleMovement::StartEngine Method

Turn On the engine effects

C++
virtual bool StartEngine() = 0;
Description

It will soon be replaced by an event passed with the OnEvent function.

IVehicleMovement::StopDriving Method

The vehicle has stopped being driven.

C++
virtual void StopDriving() = 0;
Description

The vehicle is not being driven any more.

IVehicleMovement::StopEngine Method

Turn Off the engine effects

C++
virtual void StopEngine() = 0;
Description

It will soon be replaced by an event passed with the OnEvent function.

IVehicleMovement::UnregisterActionFilter Method
C++
virtual void UnregisterActionFilter(IVehicleMovementActionFilter* pActionFilter) = 0;
IVehicleMovement::Update Method

Updates the movement

C++
virtual void Update(const float deltaTime) = 0;
Parameters
Parameters
Description
const float deltaTime
time in seconds of the update
Description

Will update the vehicle movement for a specified frame time. Unlike the ProcessMovement function, this function is called from the Update function of IVehicle.

IVehicleMovement::UseDrivingProxy Method
C++
virtual bool UseDrivingProxy() const = 0;