Announcement

Collapse
No announcement yet.

Horrible Car Physics

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

    Originally posted by tegleg View Post
    thank you

    the sdk is one thing, ue4 is another
    ill try grab a PVD of the advanced car template doing this for you.

    edit;
    here you go
    https://www.dropbox.com/s/4iof6l9tz6...ring1.pvd?dl=0
    jumped off a ramp, rolled, pinged off to the other side of the map. advanced car template. its actually not that hard to do.
    The reason for this behavior is that the origin of the wheel raycasts lies above the collision capsule, so when the car turns upside down the ray intersects the triangle 'above' it. The suspension calculation probably attempts to drive the capsule into the ground, which then shoots off dramatically because of rigid body contacts. At any rate, the solution is to make sure the capsule covers the ray origin so that the raycast doesn't hit the ground when the car is upside down. The PhysX SDK sample and the basic car template have large collision boxes for the car bodies that prevent this from occurring. We'll need to craft better invisible collision geometry and/or ray filtering for open-wheeled cars.

    In the first image the car is upside-down and falling towards the ground. The raycast origins can be seen as small green lines poking from the top of the capsules (the bottom of the capsules as seen in the picture). In the second picture the car has contacted the ground, and the red color of the raycast indicates that it is intersecting the triangle 'under' the upside-down car. The third picture is the same frame as the second, but taken from below the ground, showing slight penetration of the capsule, which may be due to the suspension forces mistakenly attempting to drive the upside-down car further into the ground.

    Click image for larger version

Name:	raycast_origin_outside.JPG
Views:	1
Size:	54.5 KB
ID:	1061495Click image for larger version

Name:	raycast_origin_outside2.JPG
Views:	1
Size:	46.3 KB
ID:	1061496Click image for larger version

Name:	raycast_origin_outside3.JPG
Views:	1
Size:	30.2 KB
ID:	1061497

    Comment


      We'll need to craft better invisible collision geometry and/or ray filtering for open-wheeled cars
      ok i see.
      so you can make an f1 car but the collision hull would resemble a box van, cool.
      there seems to be a significant design flaw in several aspects of physx wheels...

      might revisit my original idea of using physics asset based collision for the wheels, raycast wheels dont seem quite up to the job.
      the only problem there was the wheels were a bit wobbly and caused the car to bounce with excessive wheel spin.
      tegleg.co.uk - indie electronic music label
      Android + HTML5 WIP Physics Game
      PC Games - Android Apps

      Comment


        Originally posted by tegleg View Post
        ok i see.
        so you can make an f1 car but the collision hull would resemble a box van, cool.
        there seems to be a significant design flaw in several aspects of physx wheels...

        might revisit my original idea of using physics asset based collision for the wheels, raycast wheels dont seem quite up to the job.
        the only problem there was the wheels were a bit wobbly and caused the car to bounce with excessive wheel spin.
        I don't think the situation is quite that bleak. The collision hull doesn't have to resemble a box van. In the case of this advanced car model, I think lowering the raycast origin to be within the capsules would fix this particular problem. Raycast wheel techniques have been used in many driving games over the years, with open wheels or otherwise. When I have time next week I will try to make some improvements to the F1-style invisible collision shapes, and I will explore collision shapes that move with the wheels.

        I don't think you will get satisfactory behavior from wheels made of rigid body physics assets. You will get the car to roll, but it won't perform very well because rigid body contacts do not resemble tire contacts.

        Comment


          I have some good news for the longer term: the vehicle system in our upcoming PhysX-3.4 will introduce a more advanced wheel shape mechanism that should eliminate many of the problems we are seeing with raycast clipping. The wheel shape will allow contacts along the suspension direction to defer to the raycast, but will provide rigid body collision along other directions to prevent, for example, the problem where the wheel climbs up the guard rail.

          Unfortunately, PhysX-3.4 itself is a long ways off, it won't be out until the middle of 2015; however, it may be possible to back-port the updated vehicle code to PhysX-3.3.x. I can't specify a delivery date at this point, but I'll try to make it a high priority.
          Last edited by Mike.Skolones; 12-02-2014, 03:07 PM.

          Comment


            thats really good news, looking forward to it
            thanks for all your hard work mike
            tegleg.co.uk - indie electronic music label
            Android + HTML5 WIP Physics Game
            PC Games - Android Apps

            Comment


              Hi,

              If you are interested, I'm putting together a test project for working out vehicle issues, starting with the C++ Advanced template. You'll find it here: https://github.com/NvPhysX/UnrealEngine, synch to the 'Vehicle' branch.

              Changes so far:
              --a minor change or two to the Vehicle-related code in Engine (tire friction)
              -- a minor change to the PxVehicle code in the PhysX project (to disable the sticky tire friction constraint)
              -- several changes to the car setup in the project-specific Pawn and Wheel classes. As it stands the car is rear-wheel drive with a limited slip differential. The open diff seems to work well too. I haven't tried front-wheel or four-wheel drive yet, I generally like to start with rear-wheel drive. Four-wheel-drive can hide a lot of handling problems and makes it difficult to feel the effects of many chassis parameters.
              -- change to the controller input, so that the Xbox left-joystick has only steering, not throttle/brakes as well (throttle/brakes are on the right/left triggers).
              -- test track map: a flat track with 90-degree turns and S-turns, wider than the default map, without loop-the-loops, speed bumps, etc.

              Note that this branch includes all of the PhysX code needed to build everything. The car is generally faster, stickier, more controllable, etc., than the default tuning, and I think it suits the track reasonably well. I rarely use the brakes, and I can keep the throttle at 100% most of the time. Actual speed doesn't much exceed 100kph, but the track is very tight. I still see a few flying-car artifacts occasionally when running over the curbs, especially at an S-turn if you hit multiple curbs. I didn't check to see if the drag bug was fixed, it's on the list.

              Cheers,
              Mike





              Click image for larger version

Name:	track1.JPG
Views:	1
Size:	138.6 KB
ID:	1064490
              Last edited by Mike.Skolones; 12-23-2014, 05:30 PM.

              Comment


                hey tegleg! nice to see you on the ue4 forum, I've looked at your vehicle tutorial alot on the udk to get my own porsche working (not related to topic, just wanted to say hi.)

                Comment


                  Originally posted by Mike.Skolones View Post
                  I still see a few flying-car artifacts occasionally when running over the curbs, especially at an S-turn if you hit multiple curbs.
                  Hi,
                  I'm also battling with this issue, If you remember: https://answers.unrealengine.com/que...ange-jump.html 4.6 didn't solve the problem.
                  I can even reproduce this issue in sample from Physx ;0(3.3.1 or 3.3.2), but it occurs less frequently than with my cars in UE4:
                  https://www.youtube.com/watch?v=CRAG...ature=youtu.be

                  And of course I still don't have idea how to fix this problem, I recorded some pvd sessions but this give me nothing, the car suddenly rotates out of blue in 1 frame; )

                  pvd from sdk sample, interesting frames 555-557
                  https://www.dropbox.com/s/jvr67254uv..._bubu.pvd?dl=0

                  my vehicle in UE4, frames 544 -> 545
                  https://www.dropbox.com/s/e8vhksniyw...bubu3.pvd?dl=0

                  And another session from UE4 with my vehicle, frames 823 -> 824
                  https://www.dropbox.com/s/cplgkf38xz...bubu4.pvd?dl=0


                  For now I can say this is related to spring force, I logged suspSpringForce for each wheel in the void UWheeledVehicleMovementComponent::UpdateDrag(float DeltaTime) function and it seems one or more wheel lost contact, then the Physx engine applies force only to one side of the vehicle and voila We get a instant chassis rotation

                  SFL:192606.296875 SFR:192605.296875 SRL:232076.203125 SRR:231464.421875
                  SFL:186490.312500 SFR:186780.328125 SRL:234527.656250 SRR:234066.281250
                  SFL:176682.843750 SFR:177213.062500 SRL:239588.421875 SRR:239325.468750
                  SFL:178754.625000 SFR:153713.421875 SRL:242704.109375 SRR:403693.156250
                  SFL:214173.750000 SFR:119001.570313 SRL:432052.968750 SRR:0.000000
                  SFL:0.000000 SFR:275239.218750 SRL:0.000000 SRR:0.000000
                  SFL:0.000000 SFR:333309.343750 SRL:0.000000 SRR:0.000000
                  SFL:0.000000 SFR:389347.812500 SRL:0.000000 SRR:0.000000
                  SFL:0.000000 SFR:373780.000000 SRL:0.000000 SRR:0.000000


                  I tried to clamp Suspension force to, 200k in the vehicle sdk, but this doesn't help at all.
                  My next idea is to modify vehicle sdk code to move some suspension force from one wheel to another wheen on other side of the vehicle when that wheel lost it contact, suspension bar,but implementing suspension bar in the vehicle sdk isn't easy task ;(
                  Last edited by Pierdek; 01-08-2015, 02:06 PM.

                  Comment


                    Originally posted by Pierdek View Post
                    Hi,
                    I'm also battling with this issue, If you remember: https://answers.unrealengine.com/que...ange-jump.html 4.6 didn't solve the problem.
                    I can even reproduce this issue in sample from Physx ;0(3.3.1 or 3.3.2), but it occurs less frequently than with my cars in UE4:
                    https://www.youtube.com/watch?v=CRAG...ature=youtu.be

                    And of course I still don't have idea how to fix this problem, I recorded some pvd sessions but this give me nothing, the car suddenly rotates out of blue in 1 frame; )

                    pvd from sdk sample, interesting frames 555-557
                    https://www.dropbox.com/s/jvr67254uv..._bubu.pvd?dl=0

                    my vehicle in UE4, frames 544 -> 545
                    https://www.dropbox.com/s/e8vhksniyw...bubu3.pvd?dl=0

                    And another session from UE4 with my vehicle, frames 823 -> 824
                    https://www.dropbox.com/s/cplgkf38xz...bubu4.pvd?dl=0


                    For now I can say this is related to spring force, I logged suspSpringForce for each wheel in the void UWheeledVehicleMovementComponent::UpdateDrag(float DeltaTime) function and it seems one or more wheel lost contact, then the Physx engine applies force only to one side of the vehicle and voila We get a instant chassis rotation

                    SFL:192606.296875 SFR:192605.296875 SRL:232076.203125 SRR:231464.421875
                    SFL:186490.312500 SFR:186780.328125 SRL:234527.656250 SRR:234066.281250
                    SFL:176682.843750 SFR:177213.062500 SRL:239588.421875 SRR:239325.468750
                    SFL:178754.625000 SFR:153713.421875 SRL:242704.109375 SRR:403693.156250
                    SFL:214173.750000 SFR:119001.570313 SRL:432052.968750 SRR:0.000000
                    SFL:0.000000 SFR:275239.218750 SRL:0.000000 SRR:0.000000
                    SFL:0.000000 SFR:333309.343750 SRL:0.000000 SRR:0.000000
                    SFL:0.000000 SFR:389347.812500 SRL:0.000000 SRR:0.000000
                    SFL:0.000000 SFR:373780.000000 SRL:0.000000 SRR:0.000000


                    I tried to clamp Suspension force to, 200k in the vehicle sdk, but this doesn't help at all.
                    My next idea is to modify vehicle sdk code to move some suspension force from one wheel to another wheen on other side of the vehicle when that wheel lost it contact, suspension bar,but implementing suspension bar in the vehicle sdk isn't easy task ;(
                    I should have some time this week to take another look. I think the flying car artifacts should have a clear cause if we look closely enough.

                    Comment


                      thanks for keeping on with this Mike, i would give it a try but my patience with ue4 ran out some time ago and its been uninstalled.

                      btw last time i used it i found yet another bug.
                      if you have the car so it leans a fair bit, like a loaded van or a soft sprung off road truck for example, the outside wheels will drop through the floor while cornering.

                      best of luck
                      tegleg.co.uk - indie electronic music label
                      Android + HTML5 WIP Physics Game
                      PC Games - Android Apps

                      Comment


                        Originally posted by tegleg View Post
                        thanks for keeping on with this Mike, i would give it a try but my patience with ue4 ran out some time ago and its been uninstalled.

                        btw last time i used it i found yet another bug.
                        if you have the car so it leans a fair bit, like a loaded van or a soft sprung off road truck for example, the outside wheels will drop through the floor while cornering.

                        best of luck
                        Sure. Yesterday I found that most of my flying-car artifacts were due to contacts between the car body collision shapes and the ground, e.g. a curb, when cornering hard.

                        I'll check on that outside-wheel problem. Was it the _visible_ wheels dropping through the ground, or the origin of the raycast? I suspect that the visual wheels cannot be drawn in the right location somehow. I haven't seen this problem, when I corner hard in a soft sprung vehicle I see it raise up on the outside wheels, and ultimately flip over. However this might depend on the location of the center of mass, and the location of the suspension force application points relative to the visual wheel representation.

                        Comment


                          the wheel visually drops through the floor, the car will lean as if the wheel is through the floor even stationary after it happens.
                          if you turn the other way while moving fast enough it will pop back out of the floor again and carry on as normal.
                          tegleg.co.uk - indie electronic music label
                          Android + HTML5 WIP Physics Game
                          PC Games - Android Apps

                          Comment


                            Originally posted by tegleg View Post
                            the wheel visually drops through the floor, the car will lean as if the wheel is through the floor even stationary after it happens.
                            if you turn the other way while moving fast enough it will pop back out of the floor again and carry on as normal.
                            I think part of this is basically the same artifact that you noticed earlier, that raycast wheels do not have a rigid body collision shape tight around the wheel itself. It's on my to-do list, to backport some changes made for PhysX-3.4, where the wheel shapes will have rigid body collision that follows the wheel closely. I wouldn't be surprised if this comes with its own artifacts, though, because handling will be affected if a contact between the rigid body wheel shape and the terrain is in conflict with the contact generated by the raycast. If the raycast origin finds its way through the floor somehow, because the chassis rigid body collision shape didn't prevent it, then all kinds of strange things might happen.

                            Comment


                              pvd from sdk sample, interesting frames 555-557
                              https://www.dropbox.com/s/jvr67254uv..._bubu.pvd?dl=0

                              --> my vehicle in UE4, frames 544 -> 545
                              https://www.dropbox.com/s/e8vhksniyw...bubu3.pvd?dl=0

                              -->And another session from UE4 with my vehicle, frames 823 -> 824
                              https://www.dropbox.com/s/cplgkf38xz...bubu4.pvd?dl=0


                              Originally posted by Mike.Skolones View Post
                              I should have some time this week to take another look. I think the flying car artifacts should have a clear cause if we look closely enough.
                              I'm having trouble accessing DropBox for some reason. My account appears to be frozen, not sure why. Can I send you an FTP where you could upload these files?

                              Thanks,
                              Mike

                              Comment


                                Hi Mike,
                                yes You can, or You don't need, I just checked all links from my original post and they should work fine now.

                                Hero You can grab code snippet for Vehicle SDK sample to make this curb.

                                https://devtalk.nvidia.com/default/t...ng-over-curbs/
                                Last edited by Pierdek; 01-08-2015, 02:07 PM.

                                Comment

                                Working...
                                X