Announcement

Collapse

The Infinity Blade Forums Have Moved

We've launched brand new Infinity Blade forums with improved features and revamped layout. We've also included a complete archive of the previous posts. Come check out the new Infinity Blade forums.
See more
See less

UDK action game - 3rd person camera code

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

  • #16
    My bindings are ok and the function from the console is detected but does nothing :S

    Btw I changed the main character so I'm not having the graphic bug anymore...

    Comment


    • #17
      Originally posted by Argaroth View Post
      My bindings are ok and the function from the console is detected but does nothing :S

      Btw I changed the main character so I'm not having the graphic bug anymore...
      You may have to add your own debug lines then. If you are seeing the debug line i put for the exec command, then it should be updating the CamOffsetDistance variable proper. Perhaps track that variable and make sure it is changing.

      Comment


      • #18
        Originally posted by xr8ed View Post
        Try adding the following code from the Camera Technical Guide to your Pawn file. It should make the player mesh visible.

        Code:
        //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);
                 UTPC.bNoCrosshair = true;
        
              }
           }
        }

        adding that code made my weapon disappear too, not only the character.
        and I'm NOT using a custom made character

        Comment


        • #19
          Hi! This is exactly what I need. Can you please explain.. Do I need to add this code to the .uc files you mentioned, create a new class or over write the existing class?

          Sorry - I'm a noob at this.

          Comment


          • #20
            This is great, pretty much exactly what i was after, i do have one question though. I'm trying to interpolate the changes in rotation so its a little more smoother. At the moment all you see is the pawn rotating in 45 degree angles. What i want to do is interpolate between the angles.
            I'm assuming that:
            Code:
                  tempAccel.Y =  PlayerInput.aStrafe * DeltaTime * 100 * PlayerInput.MoveForwardSpeed;
                  tempAccel.X = PlayerInput.aForward * DeltaTime * 100 * PlayerInput.MoveForwardSpeed;
                  tempAccel.Z = 0; //no vertical movement for now, may be needed by ladders later
            Are the 3 lines that control the new direction that the player is moving into?
            How am i able to grab the old rotation direction, and then the new direction and interpolate them?

            Originally posted by MrFisty View Post
            Hi! This is exactly what I need. Can you please explain.. Do I need to add this code to the .uc files you mentioned, create a new class or over write the existing class?

            Sorry - I'm a noob at this.
            Don't overwrite the existing class, always extend your own.

            Comment


            • #21
              ok so i named the files, ActionPawn.uc, and ActionPlayerController.uc. they are located at C:\UDK\UDK-2011-02\Development\Src\MyMod\Classes. When i go into the game the scroll thing does nothing, and when i hit tab to type in CamZoomOut, it shows both of them Out/In, but when i hit enter it doesnt do anything... :/ any help?

              Comment


              • #22
                Originally posted by syntaxerror22 View Post
                Check your log, make sure you see my "Custom pawn up" debug line, else your gameinfo class is not loading my pawn code proper. If you are using PIE you must change the default PIE gametype to your gameinfo. Search in documentation for details.

                Also, thanks to all for the compliments, and yes you can use this code for whatever. There's hardly any good 3rd person camera code, so I made this for all to use.
                I'm having the same issue, code loads up with no errors, excepting the its not loading the custom camera in the log, so that when you load up the level and play in editor nothing has changed.

                I think its because I haven't set up a development folder with all my custom scripts linking to my game, I've just been editing the originals.

                Any ideas on how I can get it working?

                Comment


                • #23
                  great

                  nice work just wondering how do i get the character to rotate with the mouse

                  Comment


                  • #24
                    Is the result supposed to aim with the camera instead of where the pawn is facing?
                    If so, how do I change it so that I can rotate the camera, but the pawn will still shoot where it is facing independently?
                    Thanks.

                    Comment


                    • #25
                      Oh nevermind, just added this and it seems to work!

                      Code:
                      simulated singular event Rotator GetBaseAimRotation()
                      {
                         local rotator   POVRot, tempRot;
                      
                         tempRot = Rotation;
                         tempRot.Pitch = 0;
                         SetRotation(tempRot);
                         POVRot = Rotation;
                         POVRot.Pitch = 0;
                      
                         return POVRot;
                      }

                      Comment


                      • #26
                        Originally posted by schnapsey View Post
                        I've just been editing the originals.
                        I think you should read up more on unreal script, editing originals is very bad... very very bad. Your best bet is to restore your originals (I sure hope you made a backup) and extend, extend, extend. Remember you can override any function, ABUSE this fact ;3

                        @Gdog12356: read the earlier posts, make sure you see the "custom pawn up" debug line, also for the scroll wheel to work you MUST change your UTinput.ini

                        @colin2010: prolly better off using the 3rd person example camera in the documentation "Camera Technical Guide"

                        Comment


                        • #27
                          i got it all working great now thanks anyways

                          Comment


                          • #28
                            I have a camera with behaviour similar to this. But when walking on an interp actor it flips and becomes verry anoying to controll. Do you have those problems aswel?


                            Originally posted by Fritz117 View Post
                            This is great, pretty much exactly what i was after, i do have one question though. I'm trying to interpolate the changes in rotation so its a little more smoother. At the moment all you see is the pawn rotating in 45 degree angles. What i want to do is interpolate between the angles.
                            I'm assuming that:
                            Code:
                                  tempAccel.Y =  PlayerInput.aStrafe * DeltaTime * 100 * PlayerInput.MoveForwardSpeed;
                                  tempAccel.X = PlayerInput.aForward * DeltaTime * 100 * PlayerInput.MoveForwardSpeed;
                                  tempAccel.Z = 0; //no vertical movement for now, may be needed by ladders later
                            Are the 3 lines that control the new direction that the player is moving into?
                            How am i able to grab the old rotation direction, and then the new direction and interpolate them?



                            Don't overwrite the existing class, always extend your own.
                            Try this for smooth rotation.

                            PHP Code:
                            //only update pawn rotation while moving
                            simulated function FaceRotation(rotator NewRotationfloat DeltaTime)
                            {
                                
                            // Do not update Pawn's rotation if no accel
                                
                            if (Normal(Acceleration)!=vect(0,0,0))
                                {
                                    
                            //Only apply rotation when falling or walking
                                    
                            if ( (Physics == PHYS_Walking) || (Physics == PHYS_Falling) )
                                    {
                                        
                            //set the rotation to the acceleration
                                        
                            NewRotation rotator((Location Normal(Acceleration))-Location);
                                        
                            NewRotation.Pitch 0;
                                    }
                                    
                            NewRotation RLerp(Rotation,NewRotation,0.33,true);
                                    
                            //apply rotation
                                    
                            SetRotation(NewRotation);
                                }

                            Comment


                            • #29
                              Amazing script syntaxerror22! the best I've seen so far! I was wondering how easy would this be to implement it in the All-in-one Camera from http://udn.epicgames.com/Three/Camer...e.html#Example because you camera script is exactly what I need and if I can get it to toggle between first person, third person and your camera that would be amazing!

                              Any idea how to go about it?

                              Comment


                              • #30
                                Hi, I've done all the needed change and only get a flying camera and no huds :S can you hel me please? I was already having a modded player controler so I juste removead the head section and added your code at the end, shloud that be the problem?

                                Comment

                                Working...
                                X