http://www.unrealsp.org/forums/viewtopic.php?t=1053
Code itself:
qtit wrote:I used for my ladders a touch function.Code: Select all
=============================================================================
//
// QLadder.
//
=============================================================================
class QLadder expands Triggers;
function Touch( actor Other ) //actor touches the ladder, calls this function
{
if( Pawn(Other) != None && Pawn(Other).bIsPlayer ) //if actor is a player do...
{
Other.SetPhysics(PHYS_Flying); //...do this
}
}
function tick(float DeltaTime) //tick tock.
{
local PlayerPawn pp; //define player class as pp
foreach TouchingActors(class'PlayerPawn',pp) //for all touching actors, if they are pp
{
if(pp.ViewRotation.Pitch < 57344 && pp.ViewRotation.Pitch > 40960) //at some point of view rotation do...
{
pp.Velocity.Z = -140; //...do this.
}
if(pp.ViewRotation.Pitch < 24576 && pp.ViewRotation.Pitch > 8192) //same as above.
{
pp.Velocity.Z = 140;
}
}
}
function UnTouch( actor Other ) //when actor untouches...
{
if( Pawn(Other) != None && Pawn(Other).bIsPlayer ) //...and is a player...
{
Other.SetPhysics(PHYS_Falling); //... go down make boom!
}
}
It uses the view rotation to determine if player climbes or not.