Announcement

Collapse
No announcement yet.

Attaching Player to Landscape - Collision/Navigation Issues

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

    Attaching Player to Landscape - Collision/Navigation Issues

    Imported a real-world landscape and replaced DefaultPawn Class with Custom Character in the GameMode (to add Custom Axis / Action Mapping Inputs). The issue I'm facing is - not able to navigate through the elevations in the landscape (even with jump).

    The Customer Character is Colliding with the Landscape and not able to move further during the step-up navigation (during step-down navigation - it is fine)
    There is a problem with Default Pawn as well - The Default Pawn is working fine with Step-Up navigation - but when I move back, the camera stays at the same height (not stepping-down to the landscape level).

    Is there a way to attach the Custom Character (which I'm using for the Default Pawn Class) to the Landscape - so that it will navigate fine with both up the hill & down the hill?

    #2
    Below is the Default Pawn GIF which shows navigation is fine uphill / step-up.
    https://drive.google.com/open?id=1db...6lpr_rEjvQlNof

    Below is the Custom Character GIF which shows that I'm getting stuck with the step.
    https://drive.google.com/open?id=17k...AYcgOjNMaam-Ww

    Appreciate any help..

    Comment


      #3
      There are several parameters within the character that determine a few things.

      Assuming ofc. That whatever character you have makes use of the default Movement Component:

      first, check the step height. Make sure the character is actually able to step over those objects.

      second, there is an option for the incline on which you can walk on. You may need to adjust that as well.

      Hope that helps.

      Comment


        #4
        Thanks MostHostLA - yes it has default movement component. Adjusting the "Walkable Floor Angle" has worked.
        Attached Files

        Comment


          #5
          Related Question - I want to place an actor on the landscape (location is set through CSV / Data Table in BP, but I only have X and Y locations but not Z location). What I would need to do is - get the landscape height (Z) at that X & Y location, and place the actor so that it is lining-up accordingly.

          Can you please suggest how this can be achieved?

          Comment


            #6
            Are you placing them once, or is this happening at runtime?

            If it's happening at runtime - assuming you have no height fall damage, you can just place them very high up and simulate. They'll find the floor themselves.

            If you are placing them ONCE via a construction script, choose a very high default Z, you can thn select all the actors and hit the HOME key, this will automatically push them all to the terrain similar as to how you would simulate.
            once placed, the actors will stay there until you move them.

            it may be best to drag them all up a unit or 2 after placement so that they can fall to the terrain on their own.
            avoid the possibility of anything getting "stuck" in the terrain or possible props.

            Comment


              #7
              It's runtime (to set the location).

              I've tried placing them high - but they are not falling to the floor (landscape). The actor has Physics Gravity set to true.
              Attached Files

              Comment


                #8
                Simulate Physics wasn't set - corrected that now.. It is working (they are back on landscape).

                As an alternative to do this right - Is there an option to "Get Landscape Location" of a particular point (and if we provide X and Y, that can give corresponding Z)?

                Comment


                  #9
                  Also - Is there a way to activate Gravity for the Player based on action (like a key press)? I need to place the player at some height when the game is started, so that I've bird's eye view of the landscape - and then when I want player to walk / navigate on the landscape, would like press that button that enables gravity and the player can walk.

                  Comment


                    #10
                    It would be very complicated to extract the correct Z for a random location.

                    Here are a few options.

                    1) Create a line trace at each location, make the lenght of the trace long enough to actually hit the terrain, and you can then use the hit result value as the amount t to subtract from the arbitrary Z you started the linetrace with.

                    2) Take the inital Z, solve the height on the heightfield file associated with the landscape based on the position you have - very complicated really.

                    3) place a box at the needed XY, set a high Z, hit home to make if fall to the landscape. Click it again and record the Z value.
                    Shoudl the terrain change, you'll need to redo the values for the area where the change occurred.

                    Moving on

                    Instead of placing the player up high, play with switching cameras. You can have several cameras at the same time and you should be able to get the views to switch over nicely.
                    For the character- change the camera to a child actor of type camera, so you can use the blend nodes.

                    Comment


                      #11
                      Thanks - Great Idea on switching cameras. I was about to go for some complex logic. Used a FlipFlop to Toggle - only problem I'm having is the Mouse Events and other Action Inputs I've created are not good with the other view - is there any way to disable them in one Camera view (or should handle by setting some boolean variable to switch accordingly with Branch)?


                      Attached Files

                      Comment


                        #12
                        only problem I'm having is the Mouse Events and other Action Inputs I've created are not good with the other view - is there any way to disable them in one Camera view (or should handle by setting some boolean variable to switch accordingly with Branch)?
                        There is an IsActive (Camera) node IIRC, that you could add to your input handlers using a Branch.
                        It would save on adding another Bool at least (its often worth having Gates to block inputs anyway).
                        As the other obvious option: the Set Input series of nodes etc, come with their own quirks / gotchas...
                        Last edited by ClavosTech; 01-18-2020, 06:32 PM.

                        Comment


                          #13
                          Thanks ClavosTech - it's working, but the Rotation seems to be from the other Camera instead of the static values set in the Event Graph (Ex: If the default Camera is looking down, the newly added Camera1 when activated is also looking down - instead, I want the Camera1 view to be always constant). Is there anything wrong with below?

                          Attached Files

                          Comment


                            #14
                            If the default Camera is looking down, the newly added Camera1 when activated is also looking down - instead, I want the Camera1 view to be always constant
                            Have you somehow parented 'Camera1' to 'Camera' in the BP components list.... So when you rotate Camera, Camera1 gets rotated too? Otherwise one shouldn't affect the other. I'd check that first as the code you've shown looks ok...

                            Comment


                              #15
                              Originally posted by ClavosTech View Post

                              Have you somehow parented 'Camera1' to 'Camera' in the BP components list.... So when you rotate Camera, Camera1 gets rotated too? Otherwise one shouldn't affect the other. I'd check that first as the code you've shown looks ok...
                              It does - thanks for the help. It's working now.

                              Comment

                              Working...
                              X