Skip to content

FluidComponent

FluidComponent

collision_radius property writable

collision_radius: float

Physical collision radius applied to every particle. Clamped to a small positive minimum. Distinct from particle_radius, which is purely visual.

color property writable

color: Vector4

Fill color (RGBA, 0-1) of the rendered fluid surface

desired_particle_count property writable

desired_particle_count: int

Number of particles to seed when filling the source shape. Changing this re-seeds the whole fluid, discarding any particles added individually via add_particle().

enable property writable

enable: bool

Whether this component is active

epsilon property writable

epsilon: float

Relaxation parameter (CFM) for the position-based fluid solver, used to prevent numerical instability in the density constraint

metaball_edge_soft property writable

metaball_edge_soft: float

Softness of the metaball surface edge falloff. Higher values give a more gradual, blurred edge.

metaball_threshold property writable

metaball_threshold: float

Density threshold at which the metaball surface renderer considers the fluid 'present'. Lower values merge particles into a smoother blob.

outline_color property writable

outline_color: Vector4

Color (RGBA, 0-1) of the fluid's rendered outline

outline_width_texels property writable

outline_width_texels: float

Width of the rendered outline, in texels

owner property

owner: Object

The Object that owns this component

particle_count property

particle_count: int

Number of particles currently in this fluid

particle_mass property writable

particle_mass: float

Mass of each individual particle. Values <= 0 are clamped to 0.01. Applies to all current particles.

particle_radius property writable

particle_radius: float

Visual radius of each rendered fluid particle. Clamped to a small positive minimum.

particles property

particles: list[FluidParticle]

All FluidParticle instances currently owned by this component

rest_density property writable

rest_density: float

Target density the fluid solver tries to maintain per particle. Values <= 0 are clamped to 0.01. Higher values make the fluid behave more incompressibly dense.

smoothing_radius property writable

smoothing_radius: float

SPH smoothing (kernel) radius used for density/pressure calculations. Larger values sample a wider neighborhood per particle.

viscosity property writable

viscosity: float

How resistant the fluid is to flowing/shearing. Values <= 0 are clamped to 0.01. Higher values make the fluid feel thicker, like honey.

vorticity_strength property writable

vorticity_strength: float

Strength of vorticity confinement, which restores small-scale swirling motion that PBF-style solvers tend to damp out. Clamped to >= 0.

add_child

add_child(obj: Object) -> Object

Add obj as a child of this component's owning Object

add_component

add_component(component_class: Any) -> typing.Any

Attach a new component of the given type to this component's owning Object.

Example
render = self.add_component(RenderComponent)

add_object

add_object(obj: Object, parent: Object = None) -> Object

Add a newly created Object to the scene, optionally parented to another Object

get_component

get_component(component_class: Any) -> typing.Any

Look up a component on this Object

get_owner

get_owner() -> Object

The Object that owns this component

get_particle

get_particle(index: SupportsInt | SupportsIndex) -> FluidParticle

Get a particle by index

has_component

has_component(component_class: Any) -> bool

Check whether this component's owning Object has a component of the given type

remove_component

remove_component(component_class: Any) -> None

Remove a component of the given type from this component's owning Object

remove_object

remove_object(obj: Object) -> None

Remove an object from the scene

remove_particle

remove_particle(particle: FluidParticle) -> None

Remove and delete a specific FluidParticle previously returned by add_particle(), particles, or get_particle()

reseed

reseed() -> None

Discard all particles (including manually added ones) and re-fill the shape according to desired_particle_count

set_collision_radius

set_collision_radius(collision_radius: SupportsFloat | SupportsIndex) -> None

Set collision_radius. See the collision_radius property.

set_color

set_color(color: Vector4) -> None

Set color. See the color property.

set_desired_particle_count

set_desired_particle_count(desired_particle_count: SupportsInt | SupportsIndex) -> None

Changing this re-seeds the whole fluid on its source shape, discarding any particles added individually via add_particle()

set_enable

set_enable(arg0: bool) -> None

Set enable. See the enable property.

set_epsilon

set_epsilon(epsilon: SupportsFloat | SupportsIndex) -> None

Set epsilon. See the epsilon property.

set_metaball_edge_soft

set_metaball_edge_soft(metaball_edge_soft: SupportsFloat | SupportsIndex) -> None

Set metaball_edge_soft. See the metaball_edge_soft property.

set_metaball_threshold

set_metaball_threshold(metaball_threshold: SupportsFloat | SupportsIndex) -> None

Set metaball_threshold. See the metaball_threshold property.

set_outline_color

set_outline_color(outline_color: Vector4) -> None

Set outline_color. See the outline_color property.

set_outline_width_texels

set_outline_width_texels(outline_width_texels: SupportsFloat | SupportsIndex) -> None

Set outline_width_texels. See the outline_width_texels property.

set_particle_mass

set_particle_mass(particle_mass: SupportsFloat | SupportsIndex) -> None

Set particle_mass. See the particle_mass property.

set_particle_radius

set_particle_radius(particle_radius: SupportsFloat | SupportsIndex) -> None

Set particle_radius. See the particle_radius property.

set_rest_density

set_rest_density(rest_density: SupportsFloat | SupportsIndex) -> None

Set rest_density. See the rest_density property.

set_smoothing_radius

set_smoothing_radius(smoothing_radius: SupportsFloat | SupportsIndex) -> None

Set smoothing_radius. See the smoothing_radius property.

set_viscosity

set_viscosity(viscosity: SupportsFloat | SupportsIndex) -> None

Set viscosity. See the viscosity property.

set_vorticity_strength

set_vorticity_strength(vorticity_strength: SupportsFloat | SupportsIndex) -> None

Set vorticity_strength. See the vorticity_strength property.

update_collision_layer_mask

update_collision_layer_mask() -> None

Sync every particle's collision_layer/collision_mask with this Object's CollisionComponent

FluidParticle

A single SPH particle owned by a FluidComponent.

collision_radius property writable

collision_radius: float

Physical collision radius of this individual particle

density property

density: float

Density computed by the solver this substep (read-only)

epsilon property writable

epsilon: float

Relaxation parameter (CFM) for this individual particle, overriding FluidComponent.epsilon

inverse_mass property writable

inverse_mass: float

1/mass of this individual particle

lambda_ property

lambda_: float

Constraint multiplier from the solver's last substep (read-only)

mass property writable

mass: float

Mass of this individual particle. Values <= 0 are clamped to 0.001.

owner property

owner: Object

The Object whose FluidComponent owns this particle

position property writable

position: Vector3

World-space position of this particle. Setting this also resets predicted_position, teleporting the particle immediately.

predicted_position property

predicted_position: Vector3

Position predicted by the solver this substep (read-only)

rest_density property writable

rest_density: float

Target density for this individual particle, overriding FluidComponent.rest_density

smoothing_radius property writable

smoothing_radius: float

SPH smoothing radius for this individual particle, overriding FluidComponent.smoothing_radius

velocity property writable

velocity: Vector3

Linear velocity of this particle

viscosity property writable

viscosity: float

Viscosity for this individual particle, overriding FluidComponent.viscosity

vorticity_strength property writable

vorticity_strength: float

Vorticity confinement strength for this individual particle, overriding FluidComponent.vorticity_strength

__repr__

__repr__() -> str

set_collision_radius

set_collision_radius(collision_radius: SupportsFloat | SupportsIndex) -> None

Set collision_radius. See the collision_radius property.

set_epsilon

set_epsilon(epsilon: SupportsFloat | SupportsIndex) -> None

Set epsilon. See the epsilon property.

set_inverse_mass

set_inverse_mass(inverse_mass: SupportsFloat | SupportsIndex) -> None

Set inverse_mass. See the inverse_mass property.

set_mass

set_mass(mass: SupportsFloat | SupportsIndex) -> None

Set mass. See the mass property.

set_position

set_position(position: Vector3) -> None

Set position. See the position property.

set_rest_density

set_rest_density(rest_density: SupportsFloat | SupportsIndex) -> None

Set rest_density. See the rest_density property.

set_smoothing_radius

set_smoothing_radius(smoothing_radius: SupportsFloat | SupportsIndex) -> None

Set smoothing_radius. See the smoothing_radius property.

set_velocity

set_velocity(velocity: Vector3) -> None

Set velocity. See the velocity property.

set_viscosity

set_viscosity(viscosity: SupportsFloat | SupportsIndex) -> None

Set viscosity. See the viscosity property.

set_vorticity_strength

set_vorticity_strength(vorticity_strength: SupportsFloat | SupportsIndex) -> None

Set vorticity_strength. See the vorticity_strength property.