@@ -53,6 +53,8 @@ pub struct ParticleDynamics {
5353 pub phase : f32 ,
5454 /// Whether this particle is active (1) or disabled (0).
5555 pub enabled : u32 ,
56+ /// Whether this particle is fixed (1) or dynamic (0).
57+ pub fixed : u32 ,
5658}
5759
5860impl ParticleDynamics {
@@ -80,9 +82,15 @@ impl ParticleDynamics {
8082 cdf : Cdf :: default ( ) ,
8183 phase : 1.0 ,
8284 enabled : 1 ,
85+ fixed : 0 ,
8386 }
8487 }
8588
89+ /// Sets whether this particle is fixed (true) or dynamic (false).
90+ pub fn set_fixed ( & mut self , fixed : bool ) {
91+ self . fixed = fixed as u32 ;
92+ }
93+
8694 /// Sets the damping coefficient for this particle.
8795 pub fn set_damping ( & mut self , damping : f32 ) {
8896 self . damping = damping;
@@ -481,6 +489,11 @@ impl<B: Backend, GpuModel: GpuParticleModelData> GpuParticles<B, GpuModel> {
481489 & self . models
482490 }
483491
492+ /// Returns mutable reference to material model buffer.
493+ pub fn models_mut ( & mut self ) -> & mut GpuTensor < GpuModel , B > {
494+ & mut self . models
495+ }
496+
484497 /// Returns reference to position buffer.
485498 pub fn positions ( & self ) -> & GpuTensor < ParticlePosition , B > {
486499 & self . positions
@@ -491,6 +504,11 @@ impl<B: Backend, GpuModel: GpuParticleModelData> GpuParticles<B, GpuModel> {
491504 & self . dynamics
492505 }
493506
507+ /// Returns mutable reference to dynamics buffer (velocity, deformation, mass).
508+ pub fn dynamics_mut ( & mut self ) -> & mut GpuTensor < ParticleDynamics , B > {
509+ & mut self . dynamics
510+ }
511+
494512 /// Returns reference to sorted particle ID buffer.
495513 pub fn sorted_ids ( & self ) -> & GpuTensor < u32 , B > {
496514 & self . sorted_ids
0 commit comments