Announcement

Collapse
No announcement yet.

UDK action game - 3rd person camera code

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

    Originally posted by Cyberspacecat View Post
    Thanks, I kinda rewrote it extending UTGame instead and using the original code in this post, it works pretty darn well now, only problem I have is that my custom mesh will not show at all, I just get the standard robot, even if I have changed the defaultproperties in my PlayerController file to match my character and her animations
    Custom mesh? You have to change the defaultproperties in your Pawn class, not PlayerController!

    Code:
    defaultproperties
    {
        WalkingPct=+0.4
        CrouchedPct=+0.4
        BaseEyeHeight=38.0
        EyeHeight=38.0
        GroundSpeed=440.0
        AirSpeed=440.0
        WaterSpeed=220.0
        AccelRate=2048.0
        JumpZ=322.0
        CrouchHeight=29.0
        CrouchRadius=21.0
        WalkableFloorZ=0.78
       
        Components.Remove(Sprite)
    
        //Light
        Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
            bSynthesizeSHLight=true
            bIsCharacterLightEnvironment=true
            bUseBooleanEnvironmentShadowing=false
            InvisibleUpdateTime=1
            MinTimeBetweenFullUpdates=.2
        End Object
        Components.Add(MyLightEnvironment)
        LightEnvironment=MyLightEnvironment
    
        //Mesh - Change it here
        Begin Object Class=SkeletalMeshComponent Name=WPawnSkeletalMeshComponent
            SkeletalMesh=SkeletalMesh'CH_LIAM_Cathode.Mesh.SK_CH_LIAM_Cathode'
            PhysicsAsset=PhysicsAsset'CH_AnimCorrupt.Mesh.SK_CH_Corrupt_Male_Physics'
            AnimSets(0)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman_BaseMale'
            AnimTreeTemplate=AnimTree'CH_AnimHuman_Tree.AT_CH_Human'
            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
            bHasPhysicsAssetInstance=true
            TickGroup=TG_PreAsyncWork
            MinDistFactorForKinematicUpdate=0.2
            bChartDistanceFactor=true
            RBDominanceGroup=20
            Scale=1.075
            bUseOnePassLightingOnTranslucency=true
            bPerBoneMotionBlur=true
        End Object
        Mesh=WPawnSkeletalMeshComponent
        Components.Add(WPawnSkeletalMeshComponent)
        
        //Collision
        Begin Object Name=CollisionCylinder
            CollisionRadius=+0021.000000
            CollisionHeight=+0044.000000
        End Object
        CylinderComponent=CollisionCylinder
    }

    Comment


      Originally posted by Derp View Post
      Custom mesh? You have to change the defaultproperties in your Pawn class, not PlayerController!

      Code:
      defaultproperties
      {
          WalkingPct=+0.4
          CrouchedPct=+0.4
          BaseEyeHeight=38.0
          EyeHeight=38.0
          GroundSpeed=440.0
          AirSpeed=440.0
          WaterSpeed=220.0
          AccelRate=2048.0
          JumpZ=322.0
          CrouchHeight=29.0
          CrouchRadius=21.0
          WalkableFloorZ=0.78
         
          Components.Remove(Sprite)
      
          //Light
          Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment
              bSynthesizeSHLight=true
              bIsCharacterLightEnvironment=true
              bUseBooleanEnvironmentShadowing=false
              InvisibleUpdateTime=1
              MinTimeBetweenFullUpdates=.2
          End Object
          Components.Add(MyLightEnvironment)
          LightEnvironment=MyLightEnvironment
      
          //Mesh - Change it here
          Begin Object Class=SkeletalMeshComponent Name=WPawnSkeletalMeshComponent
              SkeletalMesh=SkeletalMesh'CH_LIAM_Cathode.Mesh.SK_CH_LIAM_Cathode'
              PhysicsAsset=PhysicsAsset'CH_AnimCorrupt.Mesh.SK_CH_Corrupt_Male_Physics'
              AnimSets(0)=AnimSet'CH_AnimHuman.Anims.K_AnimHuman_BaseMale'
              AnimTreeTemplate=AnimTree'CH_AnimHuman_Tree.AT_CH_Human'
              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
              bHasPhysicsAssetInstance=true
              TickGroup=TG_PreAsyncWork
              MinDistFactorForKinematicUpdate=0.2
              bChartDistanceFactor=true
              RBDominanceGroup=20
              Scale=1.075
              bUseOnePassLightingOnTranslucency=true
              bPerBoneMotionBlur=true
          End Object
          Mesh=WPawnSkeletalMeshComponent
          Components.Add(WPawnSkeletalMeshComponent)
          
          //Collision
          Begin Object Name=CollisionCylinder
              CollisionRadius=+0021.000000
              CollisionHeight=+0044.000000
          End Object
          CylinderComponent=CollisionCylinder
      }
      I did though, I changed the mesh to mine, the animtree and set to mine (I kept the human physicsassets) but when I add that code all I get is the cathode robot standing in T-pose and floating around as I try and move it around, weird thing is I dont get any errors either.

      Comment


        You extend off the UTPawn class right? In that case, you will have to override the SetCharacterFromInfo function in the UTPawn class.

        Comment


          Originally posted by Derp View Post
          You extend off the UTPawn class right? In that case, you will have to override the SetCharacterFromInfo function in the UTPawn class.
          Sorry for being such a beginner on this but how exactly do I do that?

          Comment


            Originally posted by Cyberspacecat View Post
            Sorry for being such a beginner on this but how exactly do I do that?
            Place this into your current Pawn class ;
            Code:
            simulated function SetCharacterClassFromInfo(class<UTFamilyInfo> Info);
            What you're doing with that line of code is OVERRIDING the SetCharacterClassFromInfo function to basically do nothing. You were getting that issue before, because UTPawns work by getting their mesh information from FamilyInfo classes. I tend to stride away from UT classes in general.

            Comment


              Originally posted by Derp View Post
              Place this into your current Pawn class ;
              Code:
              simulated function SetCharacterClassFromInfo(class<UTFamilyInfo> Info);
              What you're doing with that line of code is OVERRIDING the SetCharacterClassFromInfo function to basically do nothing. You were getting that issue before, because UTPawns work by getting their mesh information from FamilyInfo classes. I tend to stride away from UT classes in general.
              Okay thank you, I'll try that when I get back my workstation =)

              Comment


                Thank you to everyone who helped me set this up, I now have a working 3rd person camera and my visible mesh and her animations!
                I truly appreciate the guidance, keep it up folks <3

                Comment


                  Glad to know you got it working!

                  Comment


                    Originally posted by Derp View Post
                    Glad to know you got it working!
                    sorry, for some reason it likes double-posting, lol

                    Comment


                      Originally posted by Cyberspacecat View Post
                      sorry, for some reason it likes double-posting, lol
                      It wasn't about that lol , I have the same problem too, but anyway, GOOD JOB!

                      Comment


                        Originally posted by Derp View Post
                        It wasn't about that lol , I have the same problem too, but anyway, GOOD JOB!
                        ah ok, and no good job YOU for helping me out, countless tutorials and finally got it working =)

                        Comment


                          Hi again, I'd want to throw out a little optional code request: could anyone find out how to smooth out when the camera hits a wall? it results in a lot of jittering and choppyness because it traces the walls to fast.
                          Oh and possibly as a further improvement, have a slight smoothing on the actual mouse movement, like a small delay?
                          Just throwing it out there as optional stuff to improve whats already there, I'm sure people would like that as well =)

                          Comment


                            Originally posted by Cyberspacecat View Post
                            Hi again, I'd want to throw out a little optional code request: could anyone find out how to smooth out when the camera hits a wall? it results in a lot of jittering and choppyness because it traces the walls to fast.
                            Oh and possibly as a further improvement, have a slight smoothing on the actual mouse movement, like a small delay?
                            Just throwing it out there as optional stuff to improve whats already there, I'm sure people would like that as well =)
                            Well for the camera-hitting-a-wall issue, it maybe due to this line in the trace (Calc function);

                            Code:
                            //Trace to check if cam running into wall/floor
                            if(Trace(HitLoc,HitNorm,End,Start,false,vect(12,12,12))!=none)
                            {
                                out_CamLoc = HitLoc + vecCamHeight;
                            }
                            It checks if the camera is hitting anything and then moves the camera location to the HitLocation BUT it also slightly moves it up as-well (by adding that vecCamHeight variable), giving it that un-smooth effect, I assume.

                            Comment


                              Hey guys! Sorry for necro-post, but I have a question regarding this camera - is it possible to "lock" vertical axis at some point when moving camera around? So that you can't go underneath your character or up above the character (which causes invert controls).

                              Comment


                                Fixed it:

                                Code:
                                ViewPitchMax=5000
                                ViewPitchMin=-8000
                                Put these inside Default Properties in Pawn script.

                                Comment

                                Working...
                                X