Jump to content

Recommended Posts

I try to get the state of a vehicles engine.

What I tried so far is using the EOnPhysicsActive event of the vehicle:

 

class SaRo_BMHQ_Hillbilly01_Class: Vehicle 
{
	override void EOnPhysicsActive(IEntity owner, bool activeState)
	{
		if (activeState) Print ( "Active.");
		else Print ( "Not active.");
	}

};

This detects if the physics of the vehicle get simulated and therefore it fires on movement even if initiated by another entity like another car. It also fires on initialization.

 

Question is: Is there a method to get the engines state and which method is it?

Share this post


Link to post
Share on other sites

Some vehicle components have methods for the engine.

class VehicleWheeledSimulation has

proto external bool IsEngineOn();

and class VehicleControllerComponent has

proto external bool EngineIsOn();

Both worked for me so far:

SCR_CarControllerComponent.Cast(yourvehicle.FindComponent(SCR_CarControllerComponent)).IsEngineOn();

 

VehicleWheeledSimulation.Cast(yourvehicle.FindComponent(VehicleWheeledSimulation)).EngineIsOn();

 

  • Like 1

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×