Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualSammieo

Posted 15 March 2013 - 01:36 PM

Bumping this thread up so I can give you the full code. Parts I believe to be relevant are highlighted;

 

class CrowPawn extends UTPawn;

var int IsoCamAngle;
var float CamOffsetDistance;

var() SkeletalMeshComponent BirdMesh;
var() SkeletalMeshComponent CurrMesh;

var name BirdWalkAnim;

simulated function PostBeginPlay()
{
    super.PostBeginPlay();
    AttachMesh();
    SetMeshVisibility(true);
    `log("The player crow pawn has spawned!");
}

function AttachMesh()
{
   CurrMesh = new(self) class'SkeletalMeshComponent';
   CurrMesh.SetSkeletalMesh(BirdMesh);
   CurrMesh.SetLightEnvironment( MyLightEnvironment );

   AttachComponent(CurrMesh);
}

simulated function SetMeshVisiblity(bool bVisible)
{
    super.SetMeshVisibility(bVisible);
    Mesh.SetOwnerNoSee(false);
}

simulated function bool CalcCamera(float DeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV)
{
    local Vector HitLocation, HitNormal;

    out_CamLoc           = Location;
    out_CamLoc.X        -= Cos(Rotation.Yaw * UnrRotToRad) * Cos(IsoCamAngle * UnrRotToRad) * CamOffsetDistance;
    out_CamLoc.Y        -= Sin(Rotation.Yaw * UnrRotToRad) * Cos(IsoCamAngle * UnrRotToRad) * CamOffsetDistance;
    out_CamLoc.Z        -= Sin(IsoCamAngle * UnrRotToRad) * CamOffsetDistance;

    out_CamRot.Yaw       = Rotation.Yaw;
    out_CamRot.Pitch     = IsoCamAngle;
    out_CamRot.Roll      = 0;

    if (Trace(HitLocation, HitNormal, out_CamLoc, Location, false, vect(12, 12, 12)) != none)
    {
        out_CamLoc = HitLocation;
    }

    return true;
}

defaultproperties
{
    IsoCamAngle=20
    CamOffsetDistance=190.0

    Begin Object Class=AnimNodeSequence Name=MeshSequenceA
    End Object

    /*Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
      bEnabled=TRUE
      End Object
    Components.Add(MyLightEnvironment)*/

    Begin Object= Class=SkeletalMeshComponent Name=Boobooday
          SkeletalMesh=SkeletalMesh'BirdPackage.BooboodayPacked'
          AnimSets(0)=AnimSet'BirdPackage.Armature'
          Animations=MeshSequenceA
          Materials(0)=Material'EditorMaterials.WidgetMaterial_X'
          LightEnvironment=MyLightEnvironment
          Scale3D=(X=0.25,Y=0.25,Z=0.5)
          End Object
          BirdMesh=Boobooday
          Components.Add(Boobooday)

    BirdWalkAnim = WalkOnLand
}

EDIT: Agh, sorry, the green text seems to pop up instead. :/ Ah well, you can compare with the code up above anyway. I'm wondering if something went wrong in importing the model, but I wouldn't know how; I followed the steps in these two videos:


#3Sammieo

Posted 15 March 2013 - 01:33 PM

Bumping this thread up so I can give you the full code. Parts I believe to be relevant are highlighted;
EDIT: Agh, sorry, the green text seems to pop up instead. :/ Ah well, you can compare with the code up above anyway. I'm wondering if something went wrong in importing the model, but I wouldn't know how; I followed the steps in these two videos:

 

class CrowPawn extends UTPawn;

var int IsoCamAngle;
var float CamOffsetDistance;

var() SkeletalMeshComponent BirdMesh;
var() SkeletalMeshComponent CurrMesh;

var name BirdWalkAnim;

simulated function PostBeginPlay()
{
    super.PostBeginPlay();
    AttachMesh();
    SetMeshVisibility(true);
    `log("The player crow pawn has spawned!");
}

function AttachMesh()
{
   CurrMesh = new(self) class'SkeletalMeshComponent';
   CurrMesh.SetSkeletalMesh(BirdMesh);
   CurrMesh.SetLightEnvironment( MyLightEnvironment );

   AttachComponent(CurrMesh);
}

simulated function SetMeshVisiblity(bool bVisible)
{
    super.SetMeshVisibility(bVisible);
    Mesh.SetOwnerNoSee(false);
}

simulated function bool CalcCamera(float DeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV)
{
    local Vector HitLocation, HitNormal;

    out_CamLoc           = Location;
    out_CamLoc.X        -= Cos(Rotation.Yaw * UnrRotToRad) * Cos(IsoCamAngle * UnrRotToRad) * CamOffsetDistance;
    out_CamLoc.Y        -= Sin(Rotation.Yaw * UnrRotToRad) * Cos(IsoCamAngle * UnrRotToRad) * CamOffsetDistance;
    out_CamLoc.Z        -= Sin(IsoCamAngle * UnrRotToRad) * CamOffsetDistance;

    out_CamRot.Yaw       = Rotation.Yaw;
    out_CamRot.Pitch     = IsoCamAngle;
    out_CamRot.Roll      = 0;

    if (Trace(HitLocation, HitNormal, out_CamLoc, Location, false, vect(12, 12, 12)) != none)
    {
        out_CamLoc = HitLocation;
    }

    return true;
}

defaultproperties
{
    IsoCamAngle=20
    CamOffsetDistance=190.0

    Begin Object Class=AnimNodeSequence Name=MeshSequenceA
    End Object

    /*Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
      bEnabled=TRUE
      End Object
    Components.Add(MyLightEnvironment)*/

    Begin Object= Class=SkeletalMeshComponent Name=Boobooday
          SkeletalMesh=SkeletalMesh'BirdPackage.BooboodayPacked'
          AnimSets(0)=AnimSet'BirdPackage.Armature'
          Animations=MeshSequenceA
          Materials(0)=Material'EditorMaterials.WidgetMaterial_X'
          LightEnvironment=MyLightEnvironment
          Scale3D=(X=0.25,Y=0.25,Z=0.5)
          End Object
          BirdMesh=Boobooday
          Components.Add(Boobooday)

    BirdWalkAnim = WalkOnLand
}

#2Sammieo

Posted 15 March 2013 - 12:28 PM

Bumping this thread up so I can give you the full code. Parts I believe to be relevant are highlighted;
EDIT: Agh, sorry, the green text seems to pop up instead. :/

 

class CrowPawn extends UTPawn;

var int IsoCamAngle;
var float CamOffsetDistance;

var() SkeletalMeshComponent BirdMesh;
var() SkeletalMeshComponent CurrMesh;

var name BirdWalkAnim;

simulated function PostBeginPlay()
{
    super.PostBeginPlay();
    AttachMesh();
    SetMeshVisibility(true);
    `log("The player crow pawn has spawned!");
}

function AttachMesh()
{
   CurrMesh = new(self) class'SkeletalMeshComponent';
   CurrMesh.SetSkeletalMesh(BirdMesh);
   CurrMesh.SetLightEnvironment( MyLightEnvironment );

   AttachComponent(CurrMesh);
}

simulated function SetMeshVisiblity(bool bVisible)
{
    super.SetMeshVisibility(bVisible);
    Mesh.SetOwnerNoSee(false);
}

simulated function bool CalcCamera(float DeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV)
{
    local Vector HitLocation, HitNormal;

    out_CamLoc           = Location;
    out_CamLoc.X        -= Cos(Rotation.Yaw * UnrRotToRad) * Cos(IsoCamAngle * UnrRotToRad) * CamOffsetDistance;
    out_CamLoc.Y        -= Sin(Rotation.Yaw * UnrRotToRad) * Cos(IsoCamAngle * UnrRotToRad) * CamOffsetDistance;
    out_CamLoc.Z        -= Sin(IsoCamAngle * UnrRotToRad) * CamOffsetDistance;

    out_CamRot.Yaw       = Rotation.Yaw;
    out_CamRot.Pitch     = IsoCamAngle;
    out_CamRot.Roll      = 0;

    if (Trace(HitLocation, HitNormal, out_CamLoc, Location, false, vect(12, 12, 12)) != none)
    {
        out_CamLoc = HitLocation;
    }

    return true;
}

defaultproperties
{
    IsoCamAngle=20
    CamOffsetDistance=190.0

    Begin Object Class=AnimNodeSequence Name=MeshSequenceA
    End Object

    /*Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
      bEnabled=TRUE
      End Object
    Components.Add(MyLightEnvironment)*/

    Begin Object= Class=SkeletalMeshComponent Name=Boobooday
          SkeletalMesh=SkeletalMesh'BirdPackage.BooboodayPacked'
          AnimSets(0)=AnimSet'BirdPackage.Armature'
          Animations=MeshSequenceA
          Materials(0)=Material'EditorMaterials.WidgetMaterial_X'
          LightEnvironment=MyLightEnvironment
          Scale3D=(X=0.25,Y=0.25,Z=0.5)
          End Object
          BirdMesh=Boobooday
          Components.Add(Boobooday)

    BirdWalkAnim = WalkOnLand
}

#1Sammieo

Posted 15 March 2013 - 12:20 PM

Bumping this thread up so I can give you the full code. Parts I believe to be relevant are highlighted;
 

class CrowPawn extends UTPawn;

var int IsoCamAngle;
var float CamOffsetDistance;

var() SkeletalMeshComponent BirdMesh;
var() SkeletalMeshComponent CurrMesh;

var name BirdWalkAnim;

simulated function PostBeginPlay()
{
    super.PostBeginPlay();
    AttachMesh();
    SetMeshVisibility(true);
    `log("The player crow pawn has spawned!");
}

function AttachMesh()
{
   CurrMesh = new(self) class'SkeletalMeshComponent';
   CurrMesh.SetSkeletalMesh(BirdMesh);
   CurrMesh.SetLightEnvironment( MyLightEnvironment );

   AttachComponent(CurrMesh);
}

simulated function SetMeshVisiblity(bool bVisible)
{
    super.SetMeshVisibility(bVisible);
    Mesh.SetOwnerNoSee(false);
}

simulated function bool CalcCamera(float DeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV)
{
    local Vector HitLocation, HitNormal;

    out_CamLoc           = Location;
    out_CamLoc.X        -= Cos(Rotation.Yaw * UnrRotToRad) * Cos(IsoCamAngle * UnrRotToRad) * CamOffsetDistance;
    out_CamLoc.Y        -= Sin(Rotation.Yaw * UnrRotToRad) * Cos(IsoCamAngle * UnrRotToRad) * CamOffsetDistance;
    out_CamLoc.Z        -= Sin(IsoCamAngle * UnrRotToRad) * CamOffsetDistance;

    out_CamRot.Yaw       = Rotation.Yaw;
    out_CamRot.Pitch     = IsoCamAngle;
    out_CamRot.Roll      = 0;

    if (Trace(HitLocation, HitNormal, out_CamLoc, Location, false, vect(12, 12, 12)) != none)
    {
        out_CamLoc = HitLocation;
    }

    return true;
}

defaultproperties
{
    IsoCamAngle=20
    CamOffsetDistance=190.0

    Begin Object Class=AnimNodeSequence Name=MeshSequenceA
    End Object

    /*Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
      bEnabled=TRUE
      End Object
    Components.Add(MyLightEnvironment)*/

    Begin Object= Class=SkeletalMeshComponent Name=Boobooday
          SkeletalMesh=SkeletalMesh'BirdPackage.BooboodayPacked'
          AnimSets(0)=AnimSet'BirdPackage.Armature'
          Animations=MeshSequenceA
          Materials(0)=Material'EditorMaterials.WidgetMaterial_X'
          LightEnvironment=MyLightEnvironment
          Scale3D=(X=0.25,Y=0.25,Z=0.5)
          End Object
          BirdMesh=Boobooday
          Components.Add(Boobooday)

    BirdWalkAnim = WalkOnLand
}

PARTNERS