I search for solutions in this order: Past Code, Unreal Source, Wiki, BUF, groups.yahoo, google, screaming at monitor. – RegularX

Legacy:Vehicles Pre2004/Exiting

From Unreal Wiki, The Unreal Engine Documentation Site
< Legacy:Vehicles Pre2004
Revision as of 05:51, 17 November 2007 by Dyn-62-56-58-176.dslaccess.co.uk (Talk) (Moved)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Exiting while SubMerged

When you drive/fly/float your vehicle under water, and you get out, you can't move anymore, this is because your Physics is set to Falling, but it has to be Swimming. This can be fixed easy:

function bool KDriverLeave(bool bForceLeave)
{
	local Pawn OldDriver;
 
	OldDriver = Driver;
 
	// If we successfully got out of the car, make driver visible again. And check if in water.
	if( Super.KDriverLeave(bForceLeave) )
	{
		OldDriver.bHidden = false; //Also seen in the bulldog, so can't be bad :)
		//If we are in water, set the physics to swimming
		if (OldDriver.TouchingWaterVolume())
		{
			OldDriver.SetPhysics(PHYS_Swimming);
		}
		return true;
	}
	else
		return false;
}