Announcement

Collapse
No announcement yet.

Announcing Section #1 for Survival Game - Third-person Player Setup

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

    #31
    @Havoc: I believe it is actually declared by the GENERATED_BODY macro

    Comment


      #32
      Originally posted by birdfreeyahoo View Post
      @Havoc: I believe it is actually declared by the GENERATED_BODY macro
      You might be right! I never checked which of the two handles the backend magic
      Game Developer @ LODZERO - My Twitter | tomlooman.com UE4 samples & tutorials | C++ Survival Game (Open-Source)

      Comment


        #33
        Thx a lot, i really like how you have done it, very easy to read and understand and very small too which is really awesome, im excited for the next ones. Good job !

        Comment


          #34
          Thanks for the feedback guys!

          The structure is very similar to ShooterGame, which I found has a great framework for the character and weapon code.
          Game Developer @ LODZERO - My Twitter | tomlooman.com UE4 samples & tutorials | C++ Survival Game (Open-Source)

          Comment


            #35
            Hi Tom,

            Can you explain how you set the Character Rotation to the Cameras Rotation. Im trying to create this movement in my own c++ project.

            Comment


              #36
              Originally posted by OfficialKHAN View Post
              Hi Tom,

              Can you explain how you set the Character Rotation to the Cameras Rotation. Im trying to create this movement in my own c++ project.
              See Character.cpp for the spring component that supports the following:

              CameraBoomComp->bUsePawnControlRotation = true;
              Game Developer @ LODZERO - My Twitter | tomlooman.com UE4 samples & tutorials | C++ Survival Game (Open-Source)

              Comment


                #37
                Originally posted by Tom Looman View Post
                See Character.cpp for the spring component that supports the following:

                CameraBoomComp->bUsePawnControlRotation = true;

                I have this set as true but in my project when i move the camera the character does not face that direction. Also i notice in your project when i set it to true, the character still faces the direction of the camera, but you just can't look up and down.

                Edit:

                Use Controller Yaw Rotation is what i was looking for, when i disable it on the Survival Project the character does not rotate according to mouse movement. However, enabling/disabling this on my project has no effect. Any ideas?
                Last edited by OfficialKHAN; 04-18-2015, 01:35 PM.

                Comment


                  #38
                  Originally posted by OfficialKHAN View Post
                  I have this set as true but in my project when i move the camera the character does not face that direction. Also i notice in your project when i set it to true, the character still faces the direction of the camera, but you just can't look up and down.

                  Edit:

                  Use Controller Yaw Rotation is what i was looking for, when i disable it on the Survival Project the character does not rotate according to mouse movement. However, enabling/disabling this on my project has no effect. Any ideas?
                  Did you setup the proper parent/child hierachy for camera > spring > mesh ?
                  Game Developer @ LODZERO - My Twitter | tomlooman.com UE4 samples & tutorials | C++ Survival Game (Open-Source)

                  Comment


                    #39
                    Originally posted by Tom Looman View Post
                    Did you setup the proper parent/child hierachy for camera > spring > mesh ?
                    Ye the component layout is exactly like the Survival Project. The character movement rotates fine when i am Targeting, just doesn't do it by default

                    Comment


                      #40
                      Originally posted by OfficialKHAN View Post
                      Ye the component layout is exactly like the Survival Project. The character movement rotates fine when i am Targeting, just doesn't do it by default
                      Could be a AnimBlueprint issue perhaps? I would find it a bit strange that it only works while targeting.
                      Game Developer @ LODZERO - My Twitter | tomlooman.com UE4 samples & tutorials | C++ Survival Game (Open-Source)

                      Comment


                        #41
                        I may be a little behind on this, but while looking at the code, I see in the ASCharacter class this line in the constructor

                        class SURVIVALGAME_API ASCharacter : public ACharacter

                        I recognize most of that syntax except for 'SURVIVALGAME_API' I would expect this instead

                        class ASCharacter : public ACharacter

                        What is that extra part of the class declaration?

                        Comment


                          #42
                          Originally posted by Gibdion View Post
                          I may be a little behind on this, but while looking at the code, I see in the ASCharacter class this line in the constructor

                          class SURVIVALGAME_API ASCharacter : public ACharacter

                          I recognize most of that syntax except for 'SURVIVALGAME_API' I would expect this instead

                          class ASCharacter : public ACharacter

                          What is that extra part of the class declaration?
                          It's specific to UE4 way of dealing with modules, if you're just dealing with one module (which is the default) you need not worry about it, it becomes relevant when dealing with multiple game modules to import classes into another module.

                          Some info on here: http://www.gamasutra.com/blogs/Danie...ndamentals.php
                          Game Developer @ LODZERO - My Twitter | tomlooman.com UE4 samples & tutorials | C++ Survival Game (Open-Source)

                          Comment


                            #43
                            Hi, i'm studying this project, specially the networking stuff, cause i didn't do anything networked before , so I am sorry for this question with probably a obvious answer.
                            I'm a little confused about how do you get the local player controller or the character, because i'm trying to extend some functionality and i dont know how do you do that.
                            For example on SWeapon you return "MyPawn"

                            Code:
                            class ASCharacter* ASWeapon::GetPawnOwner() const
                            {
                            	return MyPawn;
                            }
                            So how does SWeapon know about the local ASCharacter? where is MyPawn initialized?

                            What i'm trying to do?
                            Well, Im just trying to get the Local Player Controller or the Character in other Actor class
                            Probably i need to get better informed, so im sorry for the very basic question , oh and for my English.
                            pd: Excuse my English.

                            Comment


                              #44
                              Originally posted by Alexarg View Post
                              Hi, i'm studying this project, specially the networking stuff, cause i didn't do anything networked before , so I am sorry for this question with probably a obvious answer.
                              I'm a little confused about how do you get the local player controller or the character, because i'm trying to extend some functionality and i dont know how do you do that.
                              For example on SWeapon you return "MyPawn"

                              Code:
                              class ASCharacter* ASWeapon::GetPawnOwner() const
                              {
                              	return MyPawn;
                              }
                              So how does SWeapon know about the local ASCharacter? where is MyPawn initialized?

                              What i'm trying to do?
                              Well, Im just trying to get the Local Player Controller or the Character in other Actor class
                              Probably i need to get better informed, so im sorry for the very basic question , oh and for my English.
                              It's the function below GetPawnOwner, called SetOwningPawn() which is set by OnEnterInventory() in our weapon class.

                              This is one of those things you'll have some difficulty wrapping your head around when you're starting to deal with the game framework and replication.

                              If you have any interaction with the Actor that requires the Character, eg. check out ASCharacter::Use() and ASUsableActor::OnUsed(APawn* InstigatorPawn) for one example on how I pass a reference of my character into an actor.

                              Another way is to grab all pawns in your level through GetWorld()->GetPawnIterator() and use that in a for-loop like so:

                              for (FConstPawnIterator Iterator = GetWorld()->GetPawnIterator(); Iterator; ++Iterator)
                              {
                              APawn* Pawn = *Iterator;
                              if (IsValid(Pawn) && !IsSensorActor(Pawn))
                              {
                              SensePawn(*Pawn);
                              }
                              }
                              (Example from PawnSensingComponent)

                              If you want to make your game for multiplayer you cannot simply pick the first character reference you can grab, you'll need to figure out what character you need to deal with by doing something with the iterator of all pawns in the world, or by passing a reference of the character that currently interacts with the object, like I did with Use() in my Character.

                              I hope that helps! Let me know if something is still unclear.
                              Game Developer @ LODZERO - My Twitter | tomlooman.com UE4 samples & tutorials | C++ Survival Game (Open-Source)

                              Comment


                                #45
                                Thanks Tom for your time, yes i understand what you said and i had an idea about that, but i didn't know how to properly implement this, so thanks again for the help
                                pd: Excuse my English.

                                Comment

                                Working...
                                X