Skip to content
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

Add Support for Disabled Particles and Lazy Particles #11

Conversation

erayzesen
Copy link
Owner

@erayzesen erayzesen commented Jan 14, 2025

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. The Lazy property is activated for the top points, and the other points are disabled. This mesh is then added to a QSoftBodyNode 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.

@erayzesen erayzesen changed the title Add Support for Disabled Particles and One-Time Collidable Particles Add Support for Disabled Particles and Lazy Particles Jan 15, 2025
@erayzesen erayzesen marked this pull request as ready for review January 15, 2025 08:49
@erayzesen erayzesen merged commit 150fa02 into master Jan 15, 2025
48 checks passed
@erayzesen erayzesen deleted the feature/add_disabled_particles_and_one_time_collidable_particles branch January 15, 2025 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant