diff options
author | clayjohn <claynjohn@gmail.com> | 2022-12-16 11:17:23 -0800 |
---|---|---|
committer | clayjohn <claynjohn@gmail.com> | 2022-12-16 11:55:11 -0800 |
commit | 99a159cd9bf51ba485064dd09a36e0b80db978b4 (patch) | |
tree | b65fdb0288ef9cf02020d19b77dac7a804e9af2f /drivers/gles3/storage | |
parent | 2e657e51f8818401f0a54a0df3d3e74446044b93 (diff) |
Transform sdf xfrom by particle emission transform when particles are in global space
Diffstat (limited to 'drivers/gles3/storage')
-rw-r--r-- | drivers/gles3/storage/particles_storage.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/gles3/storage/particles_storage.cpp b/drivers/gles3/storage/particles_storage.cpp index 1a0d97df01..25a5d92f1f 100644 --- a/drivers/gles3/storage/particles_storage.cpp +++ b/drivers/gles3/storage/particles_storage.cpp @@ -528,6 +528,15 @@ void ParticlesStorage::_particles_process(Particles *p_particles, double p_delta //2D collision Transform2D xform = p_particles->sdf_collision_transform; //will use dotproduct manually so invert beforehand + + if (!p_particles->use_local_coords) { + Transform2D emission; + emission.columns[0] = Vector2(p_particles->emission_transform.basis.get_column(0).x, p_particles->emission_transform.basis.get_column(0).y); + emission.columns[1] = Vector2(p_particles->emission_transform.basis.get_column(1).x, p_particles->emission_transform.basis.get_column(1).y); + emission.set_origin(Vector2(p_particles->emission_transform.origin.x, p_particles->emission_transform.origin.y)); + xform = xform * emission.affine_inverse(); + } + Transform2D revert = xform.affine_inverse(); frame_params.collider_count = 1; frame_params.colliders[0].transform[0] = xform.columns[0][0]; |