-
Notifications
You must be signed in to change notification settings - Fork 1
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
Combining trigger shapes needs more elaboration #19
Comments
Looks like something has gone missing from that schema file; thanks. It's invalid and missing at least the extensions and extras, so will have to dig in to figure out what happened. As for what the structure should look like when reading/writing a glTF file, I think this is open-ended and application-specific. From the perspective of a physics description, the only important thing is marking a particular collider as producing events (whatever what means) - different applications will want to do different things with those events. There's nothing in glTF at all which tells you what to do with such an event or what it does; a particular application is going to have to add some additional extension into glTF to encode the logic and state of the associated event handler - that can be leveraged to import the triggers with some explicit structure, if it matters in that application. |
@eoineoineoin What you mention in your reply is not relevant to this issue, this isn't about defining application-specific behavior or events. This is about combining multiple trigger shapes into one "compound trigger" / "trigger body". It is imperative that we have a way to define this. For example, take a look at this configuration: I asked you about how to define an L-shaped trigger volume before, which you replied here about having a trigger shape be a child of another trigger shape. That is fine but it does not solve the problem. In the case above, neither shape's position is aligned with the origin of the "compound trigger" / "trigger body". One option would be to "bubble up" one of the shapes, but this would require altering the transforms of the nodes, thus altering the pivot and affecting behavior and animations. This is not acceptable, we need a way to specify a parent that has no shape itself but is a "compound trigger" / "trigger body" that uses child shapes. My proposal is this: Remove |
Allowing a node to have a |
@eoineoineoin How do you suggest we allow defining a "trigger body" that is made of multiple shapes? |
We've been through this. It's exactly the same as you make a non-trigger body that is composed of multiple shapes: KhronosGroup/glTF#2258 (comment). The fact that a body might be composed of triggers or "normal" colliders has no bearing on the actual behaviour of the physics. |
@eoineoineoin We have been through this, but as I explained to you, this does affect the behavior of physics. Not movement of course, the simulation will still run the same. It affects anything that uses the triggers as a trigger. If a body has 2 trigger shapes, how do you determine if those shapes should detect things individually (like a set of signals for each of Shape1 and Shape2) or if those shapes should detect together (one set of signals for both shapes)? What if an object moves from Shape1 to Shape2 but is at no point in neither shape, do we expect a signal for exiting Shape1 and entering Shape2, or do we expect no signal because it's in the same "body"? |
That depends on the use-case. Even within a single application, there will be many different use-cases, with different requirements for the signals you get. The physics extension doesn't know anything about those use-cases and the readme is very clear on this:
So, the behaviour will need to be determined by the requirements of the individual signal handlers. |
Behavior in terms of what the application does with those signals: Yes. Behavior of what triggers exist that could emit signals: No, that should be specified in KHR_rigid_bodies. As the text you've quoted describes, it is expected that triggers can be used for "overlap begin/end events". Without the ability to group two shapes as one trigger, those events would happen in the middle of the compound volume, and they would happen individually for each shape instead of for the whole trigger. Compounding these is in-scope of KHR_rigid_bodies. It's not a part of the details of how those events are "hooked into application-specific business logic". |
To be clear, triggers in general do not directly affect the physics simulation. You can remove all of the trigger shapes from the file and it will have no bearing on the actual behaviour of the physics. If KHR_rigid_bodies will not support compound triggers, then perhaps KHR_rigid_bodies should just not have triggers at all, and instead leave it to KHR_physics_trigger or similar. Because they don't affect the rigid body simulation. |
The behaviour needs to be determined entirely by the signal handlers. It is a mistake to suggest that KHR_rigid_bodies should specify any particular behaviour concerning of merging or dispatching of events. Consider this setup: It's a body with two trigger sensors for the headlights. There's three unique "listeners" attached to this object:
Your suggestion to add a "grouping" of triggers only allows to distinguish between cases 1 and 2 - it doesn't do anything to address 3. However, now that you're mandating a particular behaviour in KHR_rigid_bodies, you have made it impossible to describe all of those simultaneously. On the other hand (as I'm suggesting,) if the individual "listeners" are allowed to determine what behaviour they require, you can describe this use-case.
Splitting out this functionality into a separate extension does not solve the problem. It only adds additional complexity and we'll be having exactly the same discussion. |
https://github.com/eoineoineoin/glTF_Physics/tree/master/extensions/2.0/Khronos/KHR_rigid_bodies#triggers
The spec needs more elaboration on how multiple trigger shapes can be combined into one trigger.
With the solid colliders, the spec is pretty straightforward, any collider on a node with motion uses that motion, or uses an ancestor node's motion, or if there is no ancestor with motion then it will be a static collider.
Here @eoineoineoin gave an example of how to combine 2 triggers together, with a structure like this:
When importing into Godot, we would have to generate a node structure like this:
However, I am not sure how I would best export the above node structure out of Godot. Purely based on the example you've given so far, one option would be to make one trigger shape a child of the other. While I could move one of the shapes into the above node, that would be very messy for multiple reasons, since if the child had a transform I would have to alter the transform of the parent to match the child, then alter the other children to take that into account, and it would still alter the behavior of how the parent node moves and rotates since its pivot would change.
I don't see any explicit statement in the MSFT spec of how to combine multiple shapes into one trigger without having the parent be a shape, but from looking at the JSON schema, since
MSFT_rigid_bodies.trigger.collider
is not required, it seems like a structure like this is allowed, with an empty"trigger": {}
:If so, this would be great since it gives me a clear way to export the node structure from Godot while preserving all of the original transforms and even round-trips correctly. It looks conceptually sensible, since it's saying that this node is used as a trigger, but does not have a shape defined on the same node, therefore the shapes used must come from descendant nodes. Please let me know if this is good.
Regardless, the ways in which triggers can be combined should be stated explicitly in the spec.
The text was updated successfully, but these errors were encountered: