Alright. I updated my code with the Phys_Spider, but my if statement is having some problems
Code:
if ( (Pawn.Base == None) || (Pawn.Floor == vect(0,0,0)) )
Here's the compiler warning: 
And the updated code:
Code:
class SH2GamePlayerController extends UTPlayerController;
var Rotator aRotLocal;
var float aRollLocal;
const rollAmount = 300;
var int traceDistance;
var Quat QuatRotation;
var vector CameraOffset;
var vector OldFloor;
var vector ViewX,ViewY,ViewZ;
simulated event GetPlayerViewPoint(out vector POVLocation, out Rotator POVRotation)
{
super.GetPlayerViewPoint(POVLocation, POVRotation);
if(Pawn != none)
{
POVLocation = Pawn.Location + (CameraOffset >> Pawn.Rotation);
POVRotation = Pawn.Rotation;
}
}
//////////////////////////////////
exec function PlayerRollLeftStart() {
`log("PlayerRollLeft called");
aRollLocal -= rollAmount;
}
exec function PlayerRollLeftEnd() {
aRollLocal = 0;
}
exec function PlayerRollRightStart() {
`log("PlayerRollRight called");
aRollLocal += rollAmount;
}
exec function PlayerRollRightEnd() {
aRollLocal = 0;
}
//////////////////////////////////
simulated function PostBeginPlay()
{
super.PostBeginPlay();
QuatRotation = QuatFromAxisAndAngle( Vect(1,0,0), 0.0 );
traceDistance = 200;
Pawn.SetPhysics(PHYS_Flying);
}
//////////////////////////////////
function UpdateRotation( float DeltaTime )
{
local Rotator DeltaRot, newRotation, ViewRotation;
local float aRollAbstract, aTurnAbstract, aLookUpAbstract;
local Quat RotQuat;
aRollAbstract = aRollLocal * 0.005;
aTurnAbstract = PlayerInput.aTurn * 0.005;
aLookUpAbstract = PlayerInput.aLookUp * -0.005;
// Roll
RotQuat = QuatFromAxisAndAngle( vect(1,0,0), DeltaTime * aRollAbstract );
QuatRotation = QuatProduct(QuatRotation, RotQuat);
// Yaw
RotQuat = QuatFromAxisAndAngle( vect(0,0,1), DeltaTime * aTurnAbstract );
QuatRotation = QuatProduct(QuatRotation, RotQuat);
// Pitch
RotQuat = QuatFromAxisAndAngle( vect(0,1,0), DeltaTime * aLookUpAbstract );
QuatRotation = QuatProduct(QuatRotation, RotQuat);
//ViewRotation = Rotation;
ViewRotation = QuatToRotator(QuatRotation);
if (Pawn!=none)
{
Pawn.SetDesiredRotation(ViewRotation);
}
ProcessViewRotation( DeltaTime, ViewRotation, DeltaRot );
SetRotation(ViewRotation);
ViewShake( deltaTime );
NewRotation = ViewRotation;
NewRotation.Roll = Rotation.Roll;
if ( Pawn != None )
Pawn.FaceRotation(NewRotation, deltatime);
}
//////////////////////////////////
state PlayerSpidering
{
ignores SeePlayer, HearNoise, Bump;
event bool NotifyHitWall(vector HitNormal, actor HitActor)
{
Pawn.SetPhysics(PHYS_Spider);
Pawn.SetBase(HitActor, HitNormal);
return true;
}
// if spider mode, update rotation based on floor
function UpdateRotational(float DeltaTime, float maxPitch)
{
local rotator ViewRotation;
local vector MyFloor, CrossDir, FwdDir, OldFwdDir, OldX, RealFloor;
if ( (Pawn.Base == None) || (Pawn.Floor == vect(0,0,0)) )
MyFloor = vect(0,0,1);
else
MyFloor = Pawn.Floor;
if ( MyFloor != OldFloor )
{
// smoothly change floor
RealFloor = MyFloor;
MyFloor = Normal(6*DeltaTime * MyFloor + (1 - 6*DeltaTime) * OldFloor);
if ( (RealFloor Dot MyFloor) > 0.999 )
MyFloor = RealFloor;
// translate view direction
CrossDir = Normal(RealFloor Cross OldFloor);
FwdDir = CrossDir Cross MyFloor;
OldFwdDir = CrossDir Cross OldFloor;
ViewX = MyFloor * (OldFloor Dot ViewX)
+ CrossDir * (CrossDir Dot ViewX)
+ FwdDir * (OldFwdDir Dot ViewX);
ViewX = Normal(ViewX);
ViewZ = MyFloor * (OldFloor Dot ViewZ)
+ CrossDir * (CrossDir Dot ViewZ)
+ FwdDir * (OldFwdDir Dot ViewZ);
ViewZ = Normal(ViewZ);
OldFloor = MyFloor;
ViewY = Normal(MyFloor Cross ViewX);
}
if ( (aTurn != 0) || (aLookUp != 0) )
{
// adjust Yaw based on aTurn
if ( aTurn != 0 )
ViewX = Normal(ViewX + 2 * ViewY * Sin(0.0005*DeltaTime*aTurn));
// adjust Pitch based on aLookUp
if ( aLookUp != 0 )
{
OldX = ViewX;
ViewX = Normal(ViewX + 2 * ViewZ * Sin(0.0005*DeltaTime*aLookUp));
ViewZ = Normal(ViewX Cross ViewY);
// bound max pitch
if ( (ViewZ Dot MyFloor) < 0.707 )
{
OldX = Normal(OldX - MyFloor * (MyFloor Dot OldX));
if ( (ViewX Dot MyFloor) > 0)
ViewX = Normal(OldX + MyFloor);
else
ViewX = Normal(OldX - MyFloor);
ViewZ = Normal(ViewX Cross ViewY);
}
}
// calculate new Y axis
ViewY = Normal(MyFloor Cross ViewX);
}
ViewRotation = OrthoRotation(ViewX,ViewY,ViewZ);
SetRotation(ViewRotation);
ViewShake(deltaTime);
ViewFlash(deltaTime);
Pawn.FaceRotation(ViewRotation, deltaTime );
}
function bool NotifyLandedNow(vector HitNormal)
{
Pawn.SetPhysics(PHYS_Spider);
return bUpdating;
}
}
//////////////////////////////////
defaultproperties
{
InputClass=class'SH2GameInput'
CameraOffset=(Z=30),(X=5)
//bCollideAsEncroacher = true;
}
Bookmarks