For direct access use https://forums.oldunreal.com
It's been quite a while since oldunreal had an overhaul, but we are moving to another server which require some updates and changes. The biggest change is the migration of our old reliable YaBB forum to phpBB. This system expects you to login with your username and old password known from YaBB.
If you experience any problems there is also the usual "password forgotten" function. Don't forget to clear your browser cache!
If you have any further concerns feel free to contact me: Smirftsch@oldunreal.com

UT2003-4 Scripting

The section related to UnrealScript and modding. This board is for coders to discuss and exchange experiences or ask questions.
User avatar
Akyra
OldUnreal Member
Posts: 103
Joined: Mon Dec 13, 2010 10:40 am

UT2003-4 Scripting

Post by Akyra »

Uff..please..do you have good code for attach camera to bone player..

this does not work:

event PlayerCalcView(out actor ViewActor, out vector CameraLocation, out rotator CameraRotation )
{
bBehindView=true;
ViewActor = ViewTarget;

CameraLocation = GetBoneCoords(ViewTarget.HeadBone).Origin;
CameraRotation = GetBoneRotation(ViewTarget.HeadBone);

CameraLocation.z += 50;
CameraLocation.x -= 50;
}
User avatar
Akyra
OldUnreal Member
Posts: 103
Joined: Mon Dec 13, 2010 10:40 am

Re: UT2003-4 Scripting

Post by Akyra »

Uff..does not work too:

simulated function bool SpecialCalcView(out actor ViewActor, out vector CameraLocation, out rotator CameraRotation )
{
    local vector    HeadPos, X, Y, Z;
    local rotator HeadRot, HeadView;
local PlayerController PC;

    PC = PlayerController(Controller);

// Only do this mode if we have a playercontroller
if ( PC == none || PC.bFreeCamera )
return false;

    ViewActor = Self;
if ( PC.bBehindView ) // First Person View
{
   if(bHeadView)
    PC.ToggleBehindView();
       else
        {
         MyPawn.SetBoneScale(4,MyPawn.HeadScale,'Head');
         return false;
        }
     }

HeadPos = MyPawn.GetBoneCoords('Head').Origin;
    if (HeadPos == vect(0,0,0))
  HeadPos = Location;     //Just in case

     HeadRot = MyPawn.GetBoneRotation('Head');
     GetAxes(HeadRot, X,Y,Z);
     HeadView = OrthoRotation(-Y,-Z,X);
     HeadPos += 6*Y + 6*X;
     CameraLocation = HeadPos;

     MyPawn.SetBoneScale(4,0.05,'Head');
    //CameraLocation = HeadPos + (vect(-6.0,0,6.0) >> HeadView);   // old:(-1.0,-1.5,11.0)
    CameraRotation = Normalize(HeadView + PC.ShakeRot);//ViewShake only affects rotation
Controller.SetRotation(CameraRotation);
    return true;
}

Last edited by Akyra on Thu Jul 21, 2016 8:05 am, edited 1 time in total.
User avatar
Akyra
OldUnreal Member
Posts: 103
Joined: Mon Dec 13, 2010 10:40 am

Re: UT2003-4 Scripting

Post by Akyra »

I look vampire code..unrealclassic
I think this code does not work...?


class vPlayerNew extends vPlayer;

function CalcFirstPersonView( out vector CameraLocation, out rotator CameraRotation )
{
CameraRotation = Normalize(Rotation);
CameraLocation = vPawnNew(Pawn).AbsEyePosition();


}


defaultproperties
{
bAdrenalineEnabled=false
PawnClass=Class'vampirus.vPawnNew'
}

..................

class vPawnNew extends vPawn;

simulated function vector AbsEyePosition()
{
local Coords C;
C=GetBoneCoords('head');
return C.Origin - 1 * C.YAxis + 7 * C.XAxis + 2 * C.ZAxis;
}

simulated function vector EyePosition()
{
return GetBoneCoords('head').Origin - Location;
}

defaultproperties
{
BaseEyeHeight=30.000000
CollisionRadius=35.000000
CrouchRadius=40.000000
bOwnerNoSee=False

}
User avatar
Akyra
OldUnreal Member
Posts: 103
Joined: Mon Dec 13, 2010 10:40 am

Re: UT2003-4 Scripting

Post by Akyra »

Fully functional:

Code xPawn:

simulated function vector AbsEyePosition()
{
local Coords C;
C=GetBoneCoords('head');
return C.Origin - 1 * C.YAxis + 7 * C.XAxis + 2 * C.ZAxis;
}

Code xPlayer:

function CalcBehindView(out vector CameraLocation, out rotator CameraRotation, float Dist)
{
    local vector x, y, z;

    GetAxes(Rotation, x, y, z);

CameraRotation = Normalize(Rotation + ShakeRot);
    CameraLocation = xPawn(Pawn).AbsEyePosition() +
                     ShakeOffset.X * x +
                     ShakeOffset.Y * y +
                     ShakeOffset.Z * z;
}


Behindview 1
This is all..:)
Why?... Fully shadows, Fully mirror (texture)
Last edited by Akyra on Tue Sep 27, 2016 7:56 pm, edited 1 time in total.
User avatar
Blue
Posts: 2
Joined: Wed Oct 19, 2016 11:51 pm

Re: UT2003-4 Scripting

Post by Blue »

Excellent. Another lover of head-based camera! Keep it up! ;D

Return to “UScript Board”