Announcement

Collapse
No announcement yet.

Capsule component lagging when using AIMoveTo

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

    Capsule component lagging when using AIMoveTo

    I`m currently working on RTS in space. All ships are with fixed Z value. When ship is created its placed on a plane (Floor) with collision set on blocking.
    Every ship is moved by selecting it and clicking on the floor and then the event is firing wich uses AIMoveTo.
    Click image for larger version

Name:	Screenshot_8min.png
Views:	177
Size:	24.0 KB
ID:	1734253
    When ship is placed it interacts NavMesh
    NavMesh and ships
    When I try to move ship this happends

    Every ship (BPShip) is a character with capsule, skeletal mesh, arrow and character movement inherited.
    The structure of BPShip
    Viewport of BPShip
    I`ve added static mesh with ship model and collision box.
    Static mesh with collision
    This is a collision setup
    Capsule collisionStatick mesh (ship) collisionFloor collision
    Navmesh setup
    Navmesh
    I`ve tried a lot of things to get rid of this lagging:
    1. I`ve raised the Z value of static mesh above the capsule by 200 units. This helps and ship is moving in straight lines but it didn`t interracts witn NavMesh
    No interraction with NavMesh
    2. I`ve tried to set capsule collision to NoCollision but then the ship is falling under the floor. This is very confusing because static mesh itself has blocking with map boundaries.
    3. I`ve played with collision settings of capsule and static mesh and it didn`t help

    I want ship to use the navigation

    #2
    Hi,

    1. I`ve raised the Z value of static mesh above the capsule by 200 units. This helps and ship is moving in straight lines but it didn`t interracts witn NavMesh
    use such an approach/don't let your ships mesh influence the navmesh. If you use a capsule component as root for movement only that should interact with the navmesh. Else if I would need to guess as to what happens in your video it seems to me that since only the capsule component is used for navigation and the ships removing the navmesh around the capsule, no way is found. If you want the ships to avoid each other use RVO Avoidance or raise the radius of the capsule component to encompass the whole ship.

    2. I`ve tried to set capsule collision to NoCollision but then the ship is falling under the floor. This is very confusing because static mesh itself has blocking with map boundaries.
    As soon as you use a capsule as root component for movement (this is required to use the build in AI movement nodes like "Move To") only this capsule will influence the movement, collisions of the mesh will be ignored as far as movement is concerned, so your static mesh will never collide with any map boundaries.

    Capsule component as collision for movement is mostly used for humanoid meshes. For what you're doing you might wanna think about implementing your own movement with the ships mesh collision as collision for movement (but of course then you can't use the build in nodes like "Move To" since those only work with a capsule component as root and therefore would have to implement those on your own).

    Comment


      #3
      chrudimer, thanks for reply.
      I did what you proposed and it didn't help (you will see in video below)
      In video I reshaped capsule so that it would contain static mesh in it. Then I show collision settings for capsule and static mesh. Notice, that I have custom categories for capsule (PawnCapsule) and for static mesh (ShipMesh) and I set collision setings in a way in which PawnCapsule ignore ShipMesh and ShipMesh ignore PawnCapsule. Then you will see that when game starts ships moves around freely but they didn't interact with navmesh and then I move ship to the bottom of capsule and play again and now ship mesh interacts with navmesh.


      I tried lots of different sizes of capsule and standard collision settings with no result.

      I quite can't understand how navnesh interacts with capsule. Say if I create empty character without static mesh would it interact with navmesh? I think it should. Then why in my case capsule can't effect navmesh.
      Maybe there is a setting which corresponds to height on which static mesh is detected? Say if static mesh (it's collision box) is above 100 units then do not calculate it in navigation...

      For what you're doing you might wanna think about implementing your own movement
      Here you are talking about implementing in c++? If so, then how do I get navigation data form unreal and should I use character as a base class or I should use pawn class?

      Comment


        #4
        I don't know how to set the capsule component so that it dynamically affects the navmesh generation, and I don't know whether or not that is possible without changing the engine code.

        If you want the ships to avoid each other, you can use RVO Avoidance, don't set the static mesh to affect the navmesh. https://forums.unrealengine.com/deve...crazy-movments

        Here you are talking about implementing in c++? If so, then how do I get navigation data form unreal and should I use character as a base class or I should use pawn class?
        I implemented it in blueprints for my vehicles. You would use a pawn, since the character has character movement tied into it.
        Basically you would add a movement component to your pawn (like floating pawn movement) and then use the "Find Path to Location Synchronously" node and let the ship move along the returned path points.
        You would still need to use RVO Avoidance if you want the ships to avoid each other. With this custom movement you could use your ships mesh collision as collision for movement instead of having a capsule collision. But in your case I think I would first stick to character movement with RVO Avoidance.
        Last edited by chrudimer; 03-19-2020, 03:38 PM.

        Comment


          #5
          Chiming in.
          the ships are a skeletal mesh. Could you maybe have something going on with that as far as the anim BP goes, or anything similar that could be causing the issue?

          Also, in the last video the collision issue is that you are colliding the mesh of the ship with the plane you are clicking on.
          Last edited by MostHost LA; 03-20-2020, 03:11 AM.

          Comment


            #6
            MostHost LA, BP not have any skeletal mesh or animation. Its just static mesh. You can see it in video. So that is not the case, i assume
            Also, in the last video the collision issue is that you are colliding the mesh of the ship with the plane you are clicking on.
            Yeah, that was my mistake. I wanted to show jerky movement of ships as it was in first video but moved static mesh to low and collision of static mesh collided with floor.

            Comment

            Working...
            X