Add Support for Disabled Particles and Lazy Particles #11
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds enabled-disabled states to particles. It also introduces support for the
Lazy Particles
feature, which allows particles to respond to a collision only once until the interaction with an object ends. These features are aimed at providing significant convenience for scenarios like plants with light interactions in games or 2D water simulations.When supported by the
QMeshEditor
plugin, a simple water simulation can be added to a game as follows: A square-shaped mesh with a surface consisting of more points is created. TheLazy
property is activated for the top points, and the other points are disabled. This mesh is then added to aQSoftBodyNode
object. With just these simple steps, a basic water simulation that interacts on touch can be achieved.The same approach can be applied to plants that interact when touched by a character. However, we need to outline some specific rules here.
Particles with enabled = false:
Collisions Involving Disabled Particles:
Manifolds are generated for collisions involving particles with enabled = false. Collision information and events are triggered, but collision manifolds are not resolved.
Behavior in Body Types Like QSoftBody:
Particles with enabled = false do not move in body types where particles can move independently (like QSoftBody). Gravity and velocity integrations are not applied, and they behave almost like static objects.
Behavior in QRigidBody Objects:
In QRigidBody objects, disabled particles may appear to move. However, independent particle motion and velocity integration are not possible in QRigidBody objects. Instead, particles are transformed based on the rigid body’s position and rotation.
These details should be included in future documentation.
Lazy Particles:
Collision Response:
These particles can respond to a collision only once until the QBody object they are colliding with exits the collision state. If they re-enter the collision position, they can interacting again. They can't give a collision response to QBody objects.
Collision Information:
Even though the collision response is canceled after a single interaction with a QBody, collision information and related manifolds are still processed. However, no resolution occurs for the collision response.