Comments (4)
It sounds like the debug visualization is not updated after the first step, i.e. only at the beginning of the step, maybe?
Kinematic actors are expected to not attain the kinematic target immediately, but only at the end of the next simulation step. So this snippet:
kinematic->setRigidBodyFlag(PxRigidBodyFlag::eKINEMATIC, true);
kinematic->setGlobalPose(PxTransform(PxVec3(0.0f, 0.0f, 0.0f)));
kinematic->setKinematicTarget(PxTransform(PxVec3(1.0f, 0.0f, 0.0f)));
printf("pos = %f %f %f\n", kinematic->getGlobalPose().p.x, kinematic->getGlobalPose().p.y, kinematic->getGlobalPose().p.z);
gScene->simulate(1.0f/60.0f);
gScene->fetchResults(true);
printf("pos = %f %f %f\n", kinematic->getGlobalPose().p.x, kinematic->getGlobalPose().p.y, kinematic->getGlobalPose().p.z);
will print:
pos = 0.000000 0.000000 0.000000
pos = 1.000000 0.000000 0.000000
You can teleport the kinematic any time by calling setGlobalPose
. See also the caveat in the docs about kinematics: https://nvidia-omniverse.github.io/PhysX/physx/5.1.0/docs/RigidBodyDynamics.html#kinematic-actors
from physx.
First of all, thanks a lot for your reply and for the amazing Physx5 release.
Kinematic actors are expected to not attain the kinematic target immediately, but only at the end of the next simulation step.
Is there a benefit for the user in doing so? It seems for me rather like an oversight, especially when
comparing to "Bullet" and "Jolt Physics" which both apply the Kinematic Target prior to the simulation.
When applying the Kinematic target one frame delayed, then you are no more synced with the games 3d animations that drive
these Kinematic Bodies. Every physics response is one frame delayed and so the animated Kinematic meshes/bodies clip into dynamic bodies that should get pushed away in sync.
You can teleport the kinematic any time by calling setGlobalPose.
This works nicely to remove the one frame delay but breaks collision response because the Linear and Angular Velocity
doesn't get calculated.
If you could supply a setGlobalPose method that allows to specify linear and angular velocity then this would also be a solution to this issue.
from physx.
Is there a benefit for the user in doing so?
Yes, we infer the velocity of the kinematic from the current pose and the kinematic target, and use this velocity for interactions with dynamics.
When applying the Kinematic target one frame delayed, then you are no more synced with the games 3d animations that drive these Kinematic Bodies.
Is that not a matter of just delaying the animation too?
If you could supply a setGlobalPose method that allows to specify linear and angular velocity then this would also be a solution to this issue.
Given that we compute the kinematics' velocities from current and target pose, it does not make sense to supply velocities.
from physx.
Hey Fred,
these kinds of behavior details are important. Its hard to argue that the current approach is wrong given that as far as I can remember kinematics in PhysX have always worked like this, and its the way all kinematic PhysX in e.g. Unity and Unreal works, so it has been very broadly used and we haven't had any big complaints.
That is not to say that the behavior you ask for is necessarily less valid. I suggest you try to implement this alternate behavior with a flag like you suggest yourself, provide a PR and see if anyone else prefers it -- after all that is what the source is for.
from physx.
Related Issues (20)
- issue with getting a center of mass
- Unable to compile with Clang - __m128 is not a structure or union HOT 4
- TGS solver does not support PxPairFlag::eNOTIFY_THRESHOLD_FORCE_... flags HOT 2
- Blast build for Visual Studio 2022
- I can not link physx 5.3.0 library from vcpkg into my project HOT 3
- Static contact forces are not correct on inclined plane HOT 5
- linux - cannot build libraries (error: 'src' is an unsafe pointer used for buffer access [-Werror,-Wunsafe-buffer-usage]) HOT 10
- Bad task scheduling due to lack of priority HOT 2
- How to read data from Flow HOT 4
- Wrong includes within physx/include/extensions/PxCustomGeometryExt.h HOT 1
- D6 Joint doesn't report drive force HOT 6
- Enabling eMODIFY_CONTACTS causes jitter on wall collision. HOT 2
- Hi
- PhysXFoundation_64.dll was not found HOT 2
- Are cylinders not supported in PVD? HOT 3
- Blast & Flow compile error HOT 2
- Assert in PxcBruteForceOverlapBackface HOT 4
- PxCreateBasePhysics removed but still referenced in documentation HOT 1
- Mechanical energy is lost when setting initial velocities or applying impulses HOT 1
- PxD6 Joint Limits Exceeding -Pi and Pi
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from physx.