Results 1 to 3 of 3
  1. #1
    MSgt. Shooter Person
    Join Date
    Jan 2011
    Location
    Netherlands
    Posts
    154
    Gamer IDs

    PSN ID: Soul_Ryder

    Default accessing pawn variable within playercamera

    I made my own camera class etc through the explanation of http://udn.epicgames.com/Three/Camer...icalGuide.html

    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:

    Code:
    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
    Code:
    var CustomPawn PlayerPawn;
    add value:
    Code:
    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"
    and
    "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
    "The right man in the wrong place can make all the difference in the world."

  2. #2

    Default

    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:

    Code:
    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
    Iron Guard
    Join Date
    Feb 2010
    Location
    Bulgaria
    Posts
    606

    Default

    something like this
    PHP Code:
    class MyPawn extends Pawn;

    var 
    Rotator CamRotation;
    var 
    Vector CamLocation;

    function 
    GetCamRotation()
    {
        if(
    PlayerController(Controller) != none )
            
    PlayerController(Controller).GetPlayerViewPoint(CamLocationCamRotation);



 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.