Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 32 additions & 3 deletions src/modifier/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,9 +518,38 @@ pub enum OrientMode {

/// Orients the particle's local frame.
///
/// The orientation is calculated during the rendering of each particle. An
/// additional in-plane rotation can be optionally specified; its meaning
/// depends on the [`OrientMode`] in use.
/// The orientation is calculated during the rendering of each particle.
///
/// An additional in-plane rotation can be optionally specified; its meaning
/// depends on the [`OrientMode`] in use. Note that the in-plane rotation
/// expression should be saved as an attribute (such as [`Attribute::F32_0`])
/// if you want it to have different values per instance.
///
/// # Example
///
/// ```
/// # use bevy::prelude::*;
/// # use bevy_hanabi::*;
/// let writer = ExprWriter::new();
///
/// let init_rotation = (writer.rand(ScalarType::Float) * writer.lit(std::f32::consts::TAU)).expr();
/// let init_rotation = SetAttributeModifier::new(Attribute::F32_0, init_rotation);
///
/// let rotation = writer.attr(Attribute::F32_0).expr();
///
/// let lifetime = writer.lit(1.).expr();
/// let init_lifetime = SetAttributeModifier::new(Attribute::LIFETIME, lifetime);
///
/// let age = writer.lit(0.).expr();
/// let init_age = SetAttributeModifier::new(Attribute::AGE, age);
///
/// let asset = EffectAsset::new(256, SpawnerSettings::default(), writer.finish())
/// .with_name("orient")
/// .init(init_age)
/// .init(init_lifetime)
/// .init(init_rotation)
/// .render(OrientModifier::new(OrientMode::ParallelCameraDepthPlane).with_rotation(rotation));
/// ```
///
/// # Attributes
///
Expand Down