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

    #46
    Pawn plays fine apart from no footsteps. Play level on pc starts in my environ but with the weapon as actor. Press 'f' on the keyboard and I see my pawn but she wont move. In World properties my game is specified as game type and PIE.

    Any help welcome.

    Comment


      #47
      So it works fine in editor, but mucks up in play PC level?

      Comment


        #48
        Hi online/offworld, that right. Been searching for a setting but havent found it yet.

        Comment


          #49
          Adding this to your pawn class will be simple i guess...
          try changine the values to your liking...
          its only a simple 3rd person camera... ( no mousewheel thing )
          (i was thinking this would help someone...)

          Code:
          simulated function bool CalcCamera(float fDeltaTime, out vector out_CamLoc, out rotator out_CamRot, out float out_FOV)
          {
          	local vector startPoint, endPoint, hitLocation, hitNormal;
          	local actor actorGotHit;
          	local float playerCameraDistance, playerCameraHeightOffset;
          
          	startPoint = Location;
          	playerCameraDistance = 100.0f;         // tune this
          	playerCameraHeightOffset = 35.0f;      // tune this
          
          	if (Controller != none)
          	{
          		endPoint = Location - Vector(Controller.Rotation) * playerCameraDistance;
          	}
          	else
          	{
          		endPoint = Location - Vector(Rotation) * playerCameraDistance;
          	}
          
          	actorGotHit = Trace(hitLocation, hitNormal, endPoint, startPoint, false);
          
          	if (actorGotHit != none)
          	{
          		out_CamLoc = hitLocation;
          	}
          	else
          	{
          		out_CamLoc = endPoint;
          	}
          	
          
          	out_CamRot = Rotator(Location - out_CamLoc);
          	out_CamLoc.Z = 	out_CamLoc.Z + playerCameraHeightOffset;
          	return true;
          }
          Edit---------
          its so funny that i was naming the "hitLocation" and "hitNormal" variables as "its hit Location" and "its hit Normal" (without the spaces) and the parser in the forum turned it to "it****Location" and "it****Normal" . :P
          hehe... so funny...
          so now i changed the variable identifiers... :P

          Comment


            #50
            Hi Kanga,

            Can you zip up your scripts from your custom folder and put them online?

            Comment


              #51
              Hi online/offworld

              Its not really my intention to make you debug my stuff. You should be spending time on those tutorials we all need Anyhow below are rars with the directory paths in the names.

              www.art-werx.com/udk/dev_src_rdgame_Classes.rar
              www.art-werx.com/udk/dev_src_utgameClasses.rar
              www.art-werx.com/udk/udkgame_Config.rar

              I think there is something basic I missed.
              Cheers man and thanks in advance.

              Comment


                #52
                is the facerotation the function that lets the camera rotate seperately from the pawn?

                Comment


                  #53
                  Thanks a lot for this been trying to get this to work for last two days, and was about to make a topic about this but now don't need to.

                  I tried it out and it works great, only thing I was wondering is if you know how to fix it so the mesh turns with the camera. This way it will look like the player is shooting at what the players mesh is looking at, instead of the player shooting at what the camera is looking at while the mesh is facing a complete opposite direction. If anyone knows how to do this please share.

                  Thanks!

                  Comment


                    #54
                    I want the opposite of u! Lol!

                    Comment


                      #55
                      I asked if the facerotation is the function in which u can rotate the camera seperately from the pawn

                      Comment


                        #56
                        Can anyone answer my other post

                        Comment


                          #57
                          Is the face rotation function the one that makes the player rotate without the camera rotating with it?

                          Comment


                            #58
                            i like these camera i can't wirte coding
                            can u make code seem like these


                            i research so much
                            i haven't seen camera code like these
                            Why anyone not interest camera like these?
                            Cheer Cheer Alan wake

                            So I've never played this game but i like camera this game form watch youtube

                            i want that so much

                            Comment


                              #59
                              @ Blaklion

                              When I removed the following function:

                              simulated function FaceRotation(rotator NewRotation, float DeltaTime)
                              {
                              // Do not update Pawn's rotation if no accel
                              if (Normal(Acceleration)!=vect(0,0,0))
                              {
                              if ( Physics == PHYS_Ladder )
                              {
                              NewRotation = OnLadder.Walldir;
                              }
                              else if ( (Physics == PHYS_Walking) || (Physics == PHYS_Falling) )
                              {
                              NewRotation = rotator((Location + Normal(Acceleration))-Location);
                              NewRotation.Pitch = 0;
                              }
                              NewRotation = RLerp(Rotation,NewRotation,0.1,true);
                              SetRotation(NewRotation);
                              }

                              }


                              When you move the mouse(camera) The player moves with it as well so the players mesh will face the direction you are looking at and shoot that direction. So I believe the face rotation function is the one your looking for.

                              @ LazySnake61

                              I blocked out the following line of code in the pawn folder inside the "simulated function bool CalcCamera" function and when I did the camera no longer will flip on you.

                              out_CamRot=rotator((Location + vecCamHeight) - out_CamLoc);

                              Hope this helps!

                              Only 2 problems I'm still working on is
                              1.The mesh is floating a little bit off the ground. (fixed)
                              2. When I hit the f key to force death fake, the mesh disappears when it comes back to life. But once I death fake again the body shows up for the death, but when I come back to life again its gone.
                              If anyone knows of what I need to fix/remove/add please let me know

                              Comment


                                #60
                                Thanks for ur time and effort Hawk but I want the pawn to rotate SEPERATELY from the camera

                                Comment

                                Working...
                                X