Interface for vehicle movement class
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 }; };
IVehicleSystem.h
Interface used to implement a movement class for vehicles.
Event values for the movement
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 };
IVehicleSystem.h
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 |
All event type possible to be sent to a movement.
enum EVehicleMovementType { eVMT_Sea = 0, eVMT_Air, eVMT_Land, eVMT_Amphibious, eVMT_Walker, eVMT_Dummy, eVMT_Other };
IVehicleSystem.h
Enables/disables engine's ability to start
virtual void DisableEngine(bool disable) = 0;
Enables/disables movement processing
virtual void EnableMovementProcessing(bool enable) = 0;
This allows disabling of the actual movement processing, while still have the engine running and process driver input, effects, etc. Useful for trackview sequences
Returns the damage ratio of the engine
virtual float GetDamageRatio() = 0;
The damage ratio
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.
virtual void GetMemoryUsage(ICrySizer * s) const = 0;
virtual SVehicleMovementAction GetMovementActions() = 0;
virtual void GetMovementState(SMovementState& movementState) = 0;
Fetch the current movement state of the entity
Get movement type
virtual EVehicleMovementType GetMovementType() = 0;
virtual CryCriticalSection* GetNetworkLock() = 0;
virtual pe_type GetPhysicalizationType() const = 0;
Get a vehicle status, Can return 0 on failure as different vehicle movements will support different status information
virtual int GetStatus(SVehicleMovementStatus* status) = 0;
virtual SVehicleNetState GetVehicleNetState() = 0;
Gets number of wheel contacts, 0 if n/a
virtual int GetWheelContacts() const = 0;
Initializes the movement
virtual bool Init(IVehicle* pVehicle, const CVehicleParams& table) = 0;
Parameters |
Description |
IVehicle* pVehicle |
pointer to the vehicle which will uses this movement instance |
const CVehicleParams& table |
table which hold all the movement parameters |
Used to initialize a movement from a script table.
virtual bool IsMovementProcessingEnabled() = 0;
virtual bool IsPowered() = 0;
virtual void OnAction(const TVehicleActionId actionId, int activationMode, float value) = 0;
Sends an event message to the vehicle movement
virtual void OnEvent(EVehicleMovementEvent event, const SVehicleMovementEventParams& params) = 0;
Parameters |
Description |
EVehicleMovementEvent event |
event to be passed to the movement |
const SVehicleMovementEventParams& params |
event parameters, e.g. damage value |
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.
Change physicalization of the vehicle.
virtual void Physicalize() = 0;
PostInit, e.g. for things that need full physicalization
virtual void PostInit() = 0;
Post - physicalize.
virtual void PostPhysicalize() = 0;
virtual void PostSerialize() = 0;
Allows updates by the movement system after the view has updated
virtual void PostUpdateView(SViewParams & viewParams, EntityId playerId) = 0;
Parameters |
Description |
SViewParams & viewParams |
structure which is used to return the camera info |
EntityId playerId |
entity id of the passenger |
Optionally update the SViewParams structure will additional camera information
virtual void ProcessEvent(SEntityEvent& event) = 0;
Updates all physics related to the movement
virtual void ProcessMovement(const float deltaTime) = 0;
Parameters |
Description |
const float deltaTime |
time in seconds of the update |
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.
virtual void RegisterActionFilter(IVehicleMovementActionFilter* pActionFilter) = 0;
Releases the movement
virtual void Release() = 0;
virtual void RequestActions(const SVehicleMovementAction& movementAction) = 0;
virtual bool RequestMovement(CMovementRequest& movementRequest) = 0;
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)
Resets the movement
virtual void Reset() = 0;
Resets any input previously active in the movement
virtual void ResetInput() = 0;
virtual void Serialize(TSerialize ser, EEntityAspects aspects) = 0;
virtual void SetAuthority(bool auth) = 0;
virtual void SetVehicleNetState(const SVehicleNetState& state) = 0;
The vehicle has started being driven.
virtual bool StartDriving(EntityId driverId) = 0;
Called when the vehicle gets a new driver.
Turn On the engine effects
virtual bool StartEngine() = 0;
It will soon be replaced by an event passed with the OnEvent function.
The vehicle has stopped being driven.
virtual void StopDriving() = 0;
The vehicle is not being driven any more.
Turn Off the engine effects
virtual void StopEngine() = 0;
It will soon be replaced by an event passed with the OnEvent function.
virtual void UnregisterActionFilter(IVehicleMovementActionFilter* pActionFilter) = 0;
Updates the movement
virtual void Update(const float deltaTime) = 0;
Parameters |
Description |
const float deltaTime |
time in seconds of the update |
Will update the vehicle movement for a specified frame time. Unlike the ProcessMovement function, this function is called from the Update function of IVehicle.
virtual bool UseDrivingProxy() const = 0;