Announcement

Collapse
No announcement yet.

Moving Target Object: Collision issue

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

    Moving Target Object: Collision issue

    Hello people!

    I am working on a system that lets you spawn a certain object and move it to any place. It is also possible to pick an actor via Line trace and move it.
    The actors I am talking about don't have simulate physics enabled but collisions are.

    Now, when I move the object and the line trace doen't hit anything, everything is fine but when it does hit something the object I am moving ignores all collisions. You can see this happening in the gif below.
    I already have the sweep tag se to true in the SetActorLocation node and I really don't understand what is wrong. Also if I set simulate physics to true for the actor id doesn't move, even if the staticmesh is the root, or better it moves but slightly, until it collides with something else I believe.



    I am using a tick event and a gate node.


    Here you can see the whole chunk of code https://blueprintue.com/blueprint/g0nvebmk/ but you will probably find it really messy: I know, I started recently but I am willing to improve so if you have other suggestion regarding what I am trying to achieve I'd be happy to hear them.
    Alright, that's it... I really hope you have some suggestions for me.
    Thank you all in advance, see ya!

    #2
    I don't fully understand the description of your problem.

    However, a few things to keep in mind:

    In order for collision to occur, one or both of the bodies must be simulating physics
    -or-
    sweeps are required when moving in order for non-simulating bodies to collide

    Remember, what is happening under the hood is that kinematic and simulating bodies are being spawned into the PhysX xcene and these are generating the callbacks during the physics tick.

    If the kinematic bodies are not swpet, the physx scene will just treat them as two static bodies that were intersecting at the start tof the tick, so no callback.
    https://www.casualdistractiongames.com

    Comment


      #3
      Thank you for taking the time to reply @OptimisticMoneky

      Basically what I am trying to achieve is something similar to telekinesis.

      If I understand you correctly you are saying that the objects need to simulate physics in order for collisions to work. The problem I encounter while trying this approach is that if the spawned actor is simulating then it doesn't move, even if I set the static mesh as the root component of the actor (I need to do this for SetActorLocation apparently) if sweep is checked. I can move simulating actors IF sweep is uncheked but in this case as soon as the line trace hits something and tryes to move the actor in the 'impact point' the actor goes crazy.

      If the actors I want to move are not simulating physics I should set sweep to true, right? But this is the example in my first post, non-simulating object that goes halfway (where the pivot is) into the wall. So if you say that this should work maybe there's something in my code that is preventing sweep to work correctly.

      I would be happy to use a navmesh but I can't because most of the scene objects are going to be movable.

      Thank you again sir

      Comment


        #4
        It sounds like your issue is that you don't want the (non simulating) bodies to penetrate as you drag them around the scene.

        afaik - there is nothing to automatically prevent a kinematic (non simulating physics) body from interpenetrating another body.
        (For simulating bodies, the physics simulation solve penetrations by applying forces to the bodies. But in order to apply restitution forces, they must be simulating physics.)


        If you must use kinematic bodies, then Enabling Sweep will at least generate hit events for those collisions, and in those hit events you can manually adjust the position to prevent penetration yourself. Utilize the results from the line trace to determine the offset to apply.

        Another alternative is to use a physics body instead, and utilize a physics handle to drag it around the scene:
        https://wiki.unrealengine.com/Pick_U...bject_Tutorial

        It really depends on what you are trying to achieve
        https://www.casualdistractiongames.com

        Comment


          #5
          Yes, that's my problem, I don't want the actors I am moving to penetrate other objects.
          Well now I know at least, thank you for you patience. I will try other ways, like the one you suggested, and update this thread once I find a way.

          Comment

          Working...
          X