Announcement

Collapse
No announcement yet.

Is physics really difficult in UE4, or is it just me?

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

    Is physics really difficult in UE4, or is it just me?

    I'm having so many problems trying to get physics working on objects the way I want it to, it's getting to the point that implementing it myself is starting to look like a faster option. Am I alone? Am I just completely off track?

    Things in particular I'm having trouble with (as of 4.7.6):
    • Mass - this seems inconsistent. If I use BlockAll or OverlapAll for collision the mass has a different value. There are also multiple functions to calculate it - CalculateMass and GetMass - what's the difference?
    • Center of Mass - This changes when I attach objects, even if they have a mass of 0 - why? Even worse, I can't change the position of the Center of Mass. COMNudge seems to be ignored?
    • AddForce sometimes produces a torque - if I attach some objects to a mesh, then depending on the collision flags I sometimes get a torque. Shouldn't AddForce apply the force to the center of mass - so no torque?
    • Attaching objects - if I set bWeldSimulatedBodies to false, then the object just doesn't attach - it sits there while the parent mesh moves off. Why?


    Does anyone have any tips?

    Failing that feel free to vent. Is Physics really usable in UE4?

    #2
    I is venting!

    Yes physics is usable in unreal but its tricky pony, and stubborn one.
    I am doing physics based game and its trail and error, many things just do not add up and are illogical.

    for eg. i had asteroids perfectly set up for planar movement (physics constraint) they barely rotated (spinned) no matter what i did.
    Then i tried to free them from constraints and add force (push them back to gameplay plane instead of constraining), but it did not work (ebil pendulum effect). All i changed was locked axis in constraint from locked Z to no locked.
    So after that small experiment i locked Z axis again and removed correcting force logic. But then they started spin like mad, also sometimes disobeyed constraint.
    I think they either rotated with constraint sometimes or plain broke it. Luckily i did backup right before messing with physics.

    Also it is quite dangerous to add impulse or force from bp or code. it if just happens that you poke physical object right before it collides you can get quite funny glitches.

    So with physics if it works do not try to make it better (without doing backup first).

    Comment


      #3
      The thing to remember is that UE4 is using Physx. So go and get the Physx SDK documentation (might be in the libs directory already) and read it for info on how Physx handles things. Read the UE4 calls and see which functions they map to in Physx. The Physx documentation is pretty complete after all.

      Comment


        #4
        Same here!

        Let me give an - easy to duplicate - example.

        Let's say you want to negate the force of gravity. So you apply a force at location (bottom of the capsule) equal to the force of gravity acting on the object.

        Expect Result:
        A floating character.

        Actual Result:
        A bobbing character with accumulating scalar entropy.

        Note: I know you can turn off gravity, this is a test. For all intents and purposes, the thing should float.

        Comment


          #5
          Originally posted by The Britain View Post
          Same here!

          Let me give an - easy to duplicate - example.

          Let's say you want to negate the force of gravity. So you apply a force at location (bottom of the capsule) equal to the force of gravity acting on the object.

          Expect Result:
          A floating character.

          Actual Result:
          A bobbing character with accumulating scalar entropy.

          Note: I know you can turn off gravity, this is a test. For all intents and purposes, the thing should float.
          It should only float if you apply an equal force. But for what timestep are you applying the forces? At least compare the timesteps as these things aren't always equal. If the force is constant and gravity is constant, then yes it should float, but what if gravity is constant and your force is an impulse applied for a given time?

          Again, I point you to the Physx documentation, its not like the Epic guys have any more information than you have. Doesn't do what you want? you're welcome to fix it.

          Comment


            #6
            Originally posted by zoombapup View Post
            It should only float if you apply an equal force. But for what timestep are you applying the forces? At least compare the timesteps as these things aren't always equal. If the force is constant and gravity is constant, then yes it should float, but what if gravity is constant and your force is an impulse applied for a given time?

            Again, I point you to the Physx documentation, its not like the Epic guys have any more information than you have. Doesn't do what you want? you're welcome to fix it.
            I had several examples, but I've since deleted them. I will re-create them as a public example. I accounted for all of that.

            Also, "If the physics don't work, you have the source code." is a BULL-**** answer, as many people do not have the capability to dig around in low level source for engine physics.

            Comment


              #7
              I know GetMass() can return 0 at times - I think if the physics aren't active on the actor. GetMass() is the Physx interface. CalculateMass() is UE4's attempt to 'guess' what GetMass() will be.

              I don't know why you'd expect the components to move together if bWeldSimulatedBodies is false? The component that isn't welding itself to its parent will then run its physics simulation independent of that parent. If you want it to follow, but not be "welded" then you need some kind of joint?

              I don't know why AddForce is producing torque, nor why 0 mass objects are affecting the center of mass.

              Comment


                #8
                Originally posted by The Britain View Post
                Also, "If the physics don't work, you have the source code." is a BULL-**** answer, as many people do not have the capability to dig around in low level source for engine physics.
                +1

                Agree. That's BS advice. Even if you're on the level of a C++ savant, you still have a game to make. Sure, if you're solely the dedicated programmer with no other duties, then the investment will be fruitful. But as a game maker that kind of distracting detour is a sure-fire productivity killer...



                Originally posted by AusPaco View Post
                Failing that feel free to vent. Is Physics really usable in UE4?

                EDIT:
                Some experienced devs like Tegleg have returned to UDK because of UE4's 'broken' version of PhysX. If I find relevant posts Ill post them here...
                Last edited by ClavosTech; 05-22-2015, 02:23 PM.

                Comment


                  #9
                  Welded simulated bodies don't work properly either. You end up losing physics properties of all but the the parent object and collision between the pawn and the welded bodies becomes weird. :/

                  Comment


                    #10
                    Originally posted by Cobryis View Post
                    I don't know why you'd expect the components to move together if bWeldSimulatedBodies is false? The component that isn't welding itself to its parent will then run its physics simulation independent of that parent. If you want it to follow, but not be "welded" then you need some kind of joint?
                    I just figured that AttachTo would do just that, attach one object to another so that they move together. I thought the welding was some form of optimisation, given that it's off by default. Seems like having a function like DoSomethingEssential(bool bYesReallyDoIt). I have turned off physics simulations on the objects being attached, and they just float away.

                    My aim with this thread wasn't to trash UE4 btw, I just needed to know that I'm not alone! It's cheaper than therapy, which I think I'm going to need by the time I figure all this out.

                    Comment


                      #11
                      Originally posted by AusPaco View Post
                      My aim with this thread wasn't to trash UE4 btw, I just needed to know that I'm not alone! It's cheaper than therapy, which I think I'm going to need by the time I figure all this out.
                      No one is trashing it, hell, I would win a competition for Unreal fan-boy. I actually submitted an application to work there when I was a kid.

                      It is important that we talk about the problems with Unreal in specific areas, so we can put together the pieces and find a common culprit.

                      Comment


                        #12
                        I was starting to believe I was alone on this! Thanks for posting this. I sort of felt the same way. My major issue has also has been with things like add force and add force at location, etc

                        Comment


                          #13
                          How about this one? Here is a sample project for you all and all I do is drop some grenades and depending on the velocity they fall through the terrain. Just open and run the project with Simulate (the download is only 3.8 MB for the complete project): https://www.dropbox.com/s/79lifwyy3p...ain4.8.7z?dl=0

                          Any ideas on what is causing this? The only thing that seems to work is to jack up the Physics Sub-stepping in the project settings. I put the value at 0.005 and then they seem to work but it kills the CPU. So any clues on this PhysX issue?

                          *Please keep in mind that the grenade meshes and textures are Copyrighted materials.

                          Comment


                            #14
                            Originally posted by Kory View Post
                            How about this one? Here is a sample project for you all and all I do is drop some grenades and depending on the velocity they fall through the terrain. Just open and run the project with Simulate (the download is only 3.8 MB for the complete project): https://www.dropbox.com/s/79lifwyy3p...ain4.8.7z?dl=0

                            Any ideas on what is causing this? The only thing that seems to work is to jack up the Physics Sub-stepping in the project settings. I put the value at 0.005 and then they seem to work but it kills the CPU. So any clues on this PhysX issue?

                            *Please keep in mind that the grenade meshes and textures are Copyrighted materials.
                            Hey there, do me a favour and try this with AMI or a cooked version. I bet it doesn't fall through the terrain. PIE has some inconsistencies with physics that makes debugging this even harder.

                            Comment


                              #15
                              Originally posted by The Britain View Post
                              Hey there, do me a favour and try this with AMI or a cooked version. I bet it doesn't fall through the terrain. PIE has some inconsistencies with physics that makes debugging this even harder.
                              Well you could have tried that too, but actually we've been messing around with it. It seems that Use CCD needs to be checked on the Physics asset itself. Doing it in code or BP doesn't work. Any ideas why?

                              Comment

                              Working...
                              X