Hello, i'm having troubles with UE2Runtime - i'm trying to make vehicle mod by using ProjectMarica code from Postal2.
I'v was able to compile most of code without errors in UE2 and vehicle work in game, but the problem is that it won't rotate on desired view.
Like here [M]
For me its just static it moves Fron back, but doesn't rot on move.
I've looked further in controller class and found that it is a bit changed.
Thats from postal2,
but this is from UE2Runtime
I' cant edit them in game or recompile, so i tough maybe i can create my own player controller and assign it to Vehicle
I dont quite sure how it should be done, but damn thing works properly in Postal2, with same amount of code, but wont work in ue2, i've been wasted over 2 weeks on solving this, please could someone help me...
I'v was able to compile most of code without errors in UE2 and vehicle work in game, but the problem is that it won't rotate on desired view.
Like here [M]
I've looked further in controller class and found that it is a bit changed.
Code:
function CalcBehindView(out vector CameraLocation, out rotator CameraRotation, float Dist)
{
local vector View,HitLocation,HitNormal;
local float ViewDist;
CameraRotation = Rotation;
View = vect(1,0,0) >> CameraRotation;
if( Trace( HitLocation, HitNormal, CameraLocation - (Dist + 30) * vector(CameraRotation), CameraLocation ) != None )
ViewDist = FMin( (CameraLocation - HitLocation) Dot View, Dist );
else
ViewDist = Dist;
CameraLocation -= (ViewDist - 30) * View;
}
Thats from postal2,
but this is from UE2Runtime
Code:
function CalcBehindView(out vector CameraLocation, out rotator CameraRotation, float Dist)
{
local vector View,HitLocation,HitNormal;
local float ViewDist,RealDist;
CameraRotation = Rotation;
if ( bBlockCloseCamera )
CameraLocation.Z += 12;
View = vect(1,0,0) >> CameraRotation;
// add view radius offset to camera location and move viewpoint up from origin (amb)
RealDist = Dist;
if( Trace( HitLocation, HitNormal, CameraLocation - Dist * vector(CameraRotation), CameraLocation,false,vect(10,10,10) ) != None )
ViewDist = FMin( (CameraLocation - HitLocation) Dot View, Dist );
else
ViewDist = Dist;
if ( !bBlockCloseCamera || !bValidBehindCamera || (ViewDist > 10 + FMax(ViewTarget.CollisionRadius, ViewTarget.CollisionHeight)) )
{
//Log("Update Cam ");
bValidBehindCamera = true;
OldCameraLoc = CameraLocation - ViewDist * View;
OldCameraRot = CameraRotation;
}
else
{
//Log("Dont Update Cam "$bBlockCloseCamera@bValidBehindCamera@ViewDist);
SetRotation(OldCameraRot);
}
CameraLocation = OldCameraLoc;
CameraRotation = OldCameraRot;
}
I' cant edit them in game or recompile, so i tough maybe i can create my own player controller and assign it to Vehicle
Code:
simulated function DriverEnter(Pawn p)
{
local PlayerController PC;
local rotator ViewRotation;
local Controller C;
Driver = p;
Driver.SetCollision(false, false, false);
Driver.SetLocation(Location + (DriverPos >> Rotation));
Driver.bHidden = true;
Driver.bPhysicsAnimUpdate = false;
Driver.Velocity = vect(0,0,0);
Driver.SetPhysics(PHYS_None);
Driver.SetBase(self);
C = P.Controller;
PC = PlayerController(C);
if(PC != None)
{
ViewRotation = PC.Rotation;
ViewRotation.Yaw = Rotation.Yaw;
PC.Unpossess();
Driver.SetOwner(Self);
PC.Possess(self);
PC.MyHUD.bShowDebugInfo = true;
//PC.bBehindView = true;
PC.ClientSetBehindView(true);
PC.ClientSetViewTarget(self);
PC.ClientSetRotation(ViewRotation);
PC.GotoState(DriverState);
PC.PlayerReplicationInfo.SetWaitingPlayer(false);
bUpdateEyeHeight = true;
}
bHaveDriver = true;
if( VehicleState == 3 )
{
VehicleState = 1;
DriverEnter(p);
DriverEnterVehicle();
}
}
I dont quite sure how it should be done, but damn thing works properly in Postal2, with same amount of code, but wont work in ue2, i've been wasted over 2 weeks on solving this, please could someone help me...
Last edited by a moderator: