-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PhysX 4.1 #690
PhysX 4.1 #690
Conversation
Sources/Plasma/PubUtilLib/plAvatar/plPhysicalControllerCore.cpp
Outdated
Show resolved
Hide resolved
Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp
Outdated
Show resolved
Hide resolved
Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp
Outdated
Show resolved
Hide resolved
Sources/Plasma/PubUtilLib/plPhysX/plPXPhysicalControllerCore.cpp
Outdated
Show resolved
Hide resolved
As part of this PR, can you remove the |
c01c6f7
to
d0d1be1
Compare
159a4d4
to
91c3c73
Compare
a288522
to
1512936
Compare
35c6c7b
to
b8ac5ee
Compare
I am now largely happy with how physics behaves in game. There are still a few data file mitigations left to handle in m-a#10, but this is ready for more serious review and non-casual testing, I think.. |
28ab946
to
936d0e8
Compare
Pushed a fix for an observed crash when touching a kickable not owned by the local client. |
Updated with the new devlibs URL containing the PhysX 4.1 SDK. |
Rebased onto current master to aid compilation and review. (Someone is going to review this, right???) |
This causes PhysX cooked physicals to always be uncooked on read then re-cooked. This is a huge waste of time right now, but it allows us to continue using the old cooked physical blobs in any arbitrary physics engine.
Danger! Here be dra^H^H^Hbehavior changes: - Detector regions were previously forced to convex hulls if possible. Now they are exported as triangle mesh if set so by the artist. - Dynamics (kickables) with convex hulls were exported as "polytopes." This has been removed.
This is a rather large monolithic changeset due to the scope of the changes. To summarize: - PhysX 2.6 APIs have been upgraded to PhysX 4.1 APIs. - The CMake FindPhysX script has been rewritten for PhysX 4.1 with special considerations to the idiosyncrasies of vcpkg. - As much as possible, PhysX logic has been separated from Plasma logic by pulling the code into a separate file. - Many of the special case or bespoke aspects of the character controller have been either removed or simplified in favor of functionality built in to PhysX 4.1.
With the PhysX CCT, it was too easy to get into situations where the avatar could ride on top of a kickable to access out-of-bounds areas. Additionally, the hit force applied in those situations was at best comical and at worst frustrating due to the physics based puzzles. This rewrites the character controller to be a true dynamic rigid body in the simulation controlled by setting its linear velocity each simulation frame. The result is greatly simplified code and better interaction with the world.
Apparently, if collisions occur while we are forcibly setting the global pose of an actor, this causes some kind of internal force accumulator to, well, accumulate. Once we resume normal operation, this accumulator causes the avatar to be flung into space. Simply setting the linear velocity to zero does not fix the issue. With that in mind, we now expose another flags field on the simulation shader and selectively suppress collisions with non-triggers when the avatar brain thinks there should be no physics.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multiple people have built this locally and tested it to confirm it works. I've run one of those clients in wine and it worked. I've also been able to compile this code on Linux, and for Windows 64-bit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, just a few minor things...
This updates PhysX from version 2.6 to 4.1. I decided to go with PhysX 4.1 instead of other options such as Bullet Physics or Newton Game Dynamics due to our previous usage of PhysX. While the API has changed significantly in places, much of the simulation behavior is similar, which makes life easier. PhysX 4.1 is open source, cross platform, and supports 64-bit.
Note that this is intended to be tested with a set of minor asset fixes in H-uru/moul-assets#10. Please ensure that you are using these files before submitting commentary.
On a high level, this changeset:
override
all over the joint.Aside from dealing with API changes, this changeset overhauls the character controller significantly. PhysX's built in character controller can at best be described as "functional" in the old PhysX 2.6 case. Indeed, in the case of Jalak, it is insufficient and a bespoke mode had to be engaged. In PhysX 4.1, I saw issues where the avatar would be able to get on top of kickables and "ride" them such that it was trivial to go out of bounds while running in place on a kickable. So, the character controller is a true dynamic actor now, controlled by directly setting its linear velocity each simulation frame. This results in more realistic world interactions for the most part and greatly simplified code.
Some changes to note from the 2.6 movement handling:
Closes #4.
Depends on microsoft/vcpkg#12413 or NVIDIAGameWorks/PhysX#322.
Fixes #609.
Obsoletes and closes #667.
Depends on H-uru/moul-assets#10.