Announcement

Collapse
No announcement yet.

About character.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    About character.

    So i managed to put character as default mesh. Its too small i know, its just a test. Only thing is Animations do not work. Here is the script:

    Code:
    class REPawn extends UTPawn;
    
    var SkeletalMesh defaultMesh;
    var MaterialInterface defaultMaterial0;
    var AnimTree defaultAnimTree;
    var array<AnimSet> defaultAnimSet;
    var AnimNodeSequence defaultAnimSeq;
    var PhysicsAsset defaultPhysicsAsset;
    
    //override to make player mesh visible by default
    simulated event BecomeViewTarget( PlayerController PC )
    {
       local UTPlayerController UTPC;
    
       Super.BecomeViewTarget(PC);
    
       if (LocalPlayer(PC.Player) != None)
       {
          UTPC = UTPlayerController(PC);
          if (UTPC != None)
          {
             //set player controller to behind view and make mesh visible
             UTPC.SetBehindView(true);
             SetMeshVisibility(UTPC.bBehindView);
          }
       }
    }
    
    simulated function bool CalcCamera( float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV )
    {
       local vector CamStart, HitLocation, HitNormal, CamDirX, CamDirY, CamDirZ, CurrentCamOffset;
       local float DesiredCameraZOffset;
    
       CamStart = Location;
       CurrentCamOffset = CamOffset;
    
       DesiredCameraZOffset = (Health > 0) ? 1.2 * GetCollisionHeight() + Mesh.Translation.Z : 0.f;
       CameraZOffset = (fDeltaTime < 0.2) ? DesiredCameraZOffset * 5 * fDeltaTime + (1 - 5*fDeltaTime) * CameraZOffset : DesiredCameraZOffset;
       
       if ( Health <= 0 )
       {
          CurrentCamOffset = vect(0,0,0);
          CurrentCamOffset.X = GetCollisionRadius();
       }
    
       CamStart.Z += CameraZOffset;
       GetAxes(out_CamRot, CamDirX, CamDirY, CamDirZ);
       CamDirX *= CurrentCameraScale;
    
       if ( (Health <= 0) || bFeigningDeath )
       {
          // adjust camera position to make sure it's not clipping into world
          // @todo fixmesteve.  Note that you can still get clipping if FindSpot fails (happens rarely)
          FindSpot(GetCollisionExtent(),CamStart);
       }
       if (CurrentCameraScale < CameraScale)
       {
          CurrentCameraScale = FMin(CameraScale, CurrentCameraScale + 5 * FMax(CameraScale - CurrentCameraScale, 0.3)*fDeltaTime);
       }
       else if (CurrentCameraScale > CameraScale)
       {
          CurrentCameraScale = FMax(CameraScale, CurrentCameraScale - 5 * FMax(CameraScale - CurrentCameraScale, 0.3)*fDeltaTime);
       }
    
       if (CamDirX.Z > GetCollisionHeight())
       {
          CamDirX *= square(cos(out_CamRot.Pitch * 0.0000958738)); // 0.0000958738 = 2*PI/65536
       }
    
       out_CamLoc = CamStart - CamDirX*CurrentCamOffset.X + CurrentCamOffset.Y*CamDirY + CurrentCamOffset.Z*CamDirZ;
    
       if (Trace(HitLocation, HitNormal, out_CamLoc, CamStart, false, vect(12,12,12)) != None)
       {
          out_CamLoc = HitLocation;
       }
    
       return true;
    }
    
    simulated function SetCharacterClassFromInfo(class<utfamilyinfo> Info)
    {   
        Mesh.SetSkeletalMesh(defaultMesh); 
        Mesh.SetMaterial(0,defaultMaterial0); 
        Mesh.SetPhysicsAsset(defaultPhysicsAsset);
        Mesh.AnimSets=defaultAnimSet;
    }
    
    defaultproperties
    {
        defaultMesh=SkeletalMesh'RE.Skeletal_Meshes.Claire'
        defaultAnimTree=AnimTree'RE.Skeletal_Meshes.Character_Anim'
        defaultAnimSet(0)=AnimSet'RE.Skeletal_Meshes.Character'
        defaultPhysicsAsset=PhysicsAsset'RE.Skeletal_Meshes.Claire_Physics'
    
    }

    #2
    Anyone? please?

    Comment


      #3
      check out PostInitAnimTree() in UTPawn, make sure all the 'FindAnimNode's are trying to find your anim nodes
      and read this http://udn.epicgames.com/Three/AnimT...UserGuide.html

      Comment


        #4
        Originally posted by tegleg View Post
        check out PostInitAnimTree() in UTPawn, make sure all the 'FindAnimNode's are trying to find your anim nodes
        and read this http://udn.epicgames.com/Three/AnimT...UserGuide.html
        I have animset and anim tree ready. Only thing is that it does not seem to find animtree

        Comment


          #5
          i recomend anim slots they're the best to play anims

          Comment


            #6
            Originally posted by Neongho View Post
            i recomend anim slots they're the best to play anims
            Any info on that?

            Comment


              #7
              http://udn.epicgames.com/Three/AnimationNodes.html

              Comment


                #8
                What i did was add this piece of code from UTPawn

                Code:
                	Begin Object Class=SkeletalMeshComponent Name=CPawnSkeletalMeshComponent
                		bCacheAnimSequenceNodes=FALSE
                		AlwaysLoadOnClient=true
                		AlwaysLoadOnServer=true
                		bOwnerNoSee=false
                		CastShadow=true
                		BlockRigidBody=TRUE
                		bUpdateSkelWhenNotRendered=false
                		bIgnoreControllersWhenNotRendered=TRUE
                		bUpdateKinematicBonesFromAnimation=true
                		bCastDynamicShadow=true
                		Translation=(Z=8.0)
                		RBChannel=RBCC_Untitled3
                		RBCollideWithChannels=(Untitled3=true)
                		LightEnvironment=MyLightEnvironment
                		bOverrideAttachmentOwnerVisibility=true
                		bAcceptsDynamicDecals=FALSE
                		AnimTreeTemplate=AnimTree'RE.Skeletal_Meshes.Character_Anim'
                		bHasPhysicsAssetInstance=true
                		TickGroup=TG_PreAsyncWork
                		MinDistFactorForKinematicUpdate=0.2
                		bChartDistanceFactor=true
                		//bSkipAllUpdateWhenPhysicsAsleep=TRUE
                		RBDominanceGroup=20
                		Scale=1.075
                		// Nice lighting for hair
                		bUseOnePassLightingOnTranslucency=TRUE
                		bPerBoneMotionBlur=true
                	End Object
                	Mesh=CPawnSkeletalMeshComponent
                	Components.Add(CPawnSkeletalMeshComponent)
                As far as i understood this code makes mine AnimTree as default. I was able to play few animations, but i really need to work on character now. I guess scripts are ok now.

                Comment

                Working...
                X