Results 1 to 3 of 3

Thread: accessing pawn variable within playercamera

  1. #1

    accessing pawn variable within playercamera

    I made my own camera class etc through the explanation of

    Now in my custom pawn class I made a variable, and I try to give the variable a value inside the playerCamera class.
    But I tried to do this in a couple of ways but nothing is working. Shouldn't be so difficult to give a value to a variable...

    If i do it like this inside the CustomPlayerCamera class:

    CustomPawn.CamRot = OutVT.POV.Rotation;
    It will not work because it says CustomPawn is a bad command or expression.

    And when I do it like this:

    Create a var on top of the class
    var CustomPawn PlayerPawn;
    add value:
    PlayerPawn.CamRot = OutVT.POV.Rotation;
    It will not give an error when compiling, but it will show this when running the game

    "Attempt to assign variable through none"
    "Accessed none PlayerPawn"

    To me it looks like my Pawn class is not running properly, but I am sure it should work because my gameinfo has my custom pawn class as defaultpawnclass.

    What could be the problem?

    Thanks in advance

  2. #2
    You didn't assign anything to PlayerPawn variable, therefore it's none and you can't use it.

    If you're using the same setup as the UDN link you posted, you should have a variable named PlayerOwner in your camera. So you can do something like this to assign your pawn to PlayerPawn variable:

    PlayerPawn = CustomPawn(PlayerOwner.Pawn);
    You need to put that somewhere so it will be assigned before you wanna start to use it. Best place, at the end of your InitializeFor function.

  3. #3
    something like this
    PHP Code:
    class MyPawn extends Pawn;

    Rotator CamRotation;
    Vector CamLocation;

    PlayerController(Controller) != none )

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts