-
Notifications
You must be signed in to change notification settings - Fork 458
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
LinearCast Body missed in Sensor contact #1142
Comments
Currently there is no support for rigid bodies with motion type LinearCast vs sensors (they will be treated as Discrete vs sensors): JoltPhysics/Jolt/Physics/PhysicsSystem.cpp Lines 1837 to 1839 in ebccdcb
|
I see. Maybe that would we worth noting in the documentation? |
so the right approach would be to use ContactListener::OnContactValidate and do rejects there? sensors seems to be misleading in a way (from intuition point of view) To create a sensor, either set BodyCreationSettings::mIsSensor to true when constructing a body or set it after construction through Body::SetIsSensor. A sensor can only use the discrete motion quality type at this moment. overall looks like what for games you need a lightweight/fast event system in ContactListener so it does checks only for bodies with associated events/callbacks. |
You could use OnContactValidate to implement a sensor, but getting this call doesn't mean that this is the closest collision. Hits are roughly sorted based on closeness, so for an object with motion type LinearCast it may be that you later receive another call to OnContactValidate with a closer collision which will result in the actual contact point. ContactListener::OnContactAdded indicates that there is an actual contact and you can specify that that contact should be treated as a sensor by setting ContactSettings::mIsSensor. This disables the contact, but since we only store the closest contact point during the LinearCast sweep, this also means that the body could penetrate the object behind the sensor. |
Hello, I've noticed an issue where rigid bodies using
JPH::EMotionQuality::LinearCast
do not report contacts with sensors when moving at high speed (~100 m/s).Here is my character body creation code:
My sensor is a static body, roughly 0.2m thick. The character body is moved using
body_->SetLinearVelocity
before the physics update.Using Jolt 4.0.2, and a 60Hz update interval with 1 collision step and the single threaded job system.
The text was updated successfully, but these errors were encountered: