Godot Version
4.2.2
Question
Let say I have a ship with a chimney, the smoke emitter is hooked to the ship so as the ship moves the emitter moves with it, and so does the transform of the emitter.
I’ve got some wind that’s a global vector3 (0.5, 0, 0.5).
Now, if I apply the wind directly to the smoke emitter it’s wrong because I’ve got first to transform the Wind Vector to the Smoke local coordinates… right? Probably, but it seems the smoke is going everywhere but where it has to go. this is my code:
extends GPUParticles3D
func _ready() -> void:
# Global wind direction
var wind_direction_global: Vector3 = BattleGlobals.WindDir.normalized()
# Get the emitter's global transformation matrix
var emitter_basis: Basis = self.global_transform.basis
# Transform the global wind vector into the ship's local space
var wind_direction_local: Vector3 = wind_direction_global * emitter_basis
# Apply the local wind direction to the smoke, multiplied by the wind force
self.process_material.direction = wind_direction_local * BattleGlobals.WindForce
just for test i put on my scene 3 smoke emitters with different transforms, as you can see every emitter make smoke going in a different direction instead of the global wind one: