Giter Club home page Giter Club logo

Comments (4)

jrouwe avatar jrouwe commented on September 7, 2024

Currently there is no support for rigid bodies with motion type LinearCast vs sensors (they will be treated as Discrete vs sensors):

// TODO: For now we ignore sensors
if (body2.IsSensor())
return;

from joltphysics.

Qendolin avatar Qendolin commented on September 7, 2024

I see. Maybe that would we worth noting in the documentation?
Thank you for your quick response.

from joltphysics.

AnuraDev avatar AnuraDev commented on September 7, 2024

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)
but the docs do mention what:

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.

from joltphysics.

jrouwe avatar jrouwe commented on September 7, 2024

so the right approach would be to use ContactListener::OnContactValidate and do rejects there?

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.

from joltphysics.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.