GPUParticle3D Transform Issue

Godot Version

v.4.7.2.stable.official

Question

Good day.

I am having trouble with my racing project, but before I get into it, there is something I need to explain first.

This is my first project in the godot, I decided to make this project as a means to familiarize myself with the engine and so I am still very likely to make mistakes.
Now that I’ve made this clear, I am going to explain this issue to the best of my extent, but you are free to ask questions if necessary.

I have attached two GPUParticle3D instances to the rear wheels of my vehicle (with local cords enabled), as children of their respective VehicleWheel3D instances.
I’ve made an attempt to emit these particles at set periods (temporarily removed for testing purposes) and I found these particle instances emitting from what seems to be the spawn point of my vehicle, split apart as if they fell from the wheels of the vehicle.

I cannot move them, I have tried to re-parent these particles, and also the VehicleBody3D itself, setting the VehicleBody3D to root node does not make a difference and seems to break my camera functionality, I cannot explain why.

I do not know where I can fix this, but I believe this might be an issue elsewhere, not involving the particle instances.

Any help is much appreciated.
Thank you.

Main Scene Tree:

Scene (Node3D)
\_ Vehicle (Scene)
\_Environment (Node3D)
\_CSGBox3D
\_DirectionalLight3D
\_WorldEnvironment

Vehicle Scene Tree:

Vehicle (Node3D)
\_VehicleBody3D
\_Body_Mesh (CSGBox3D)
\_CollisionShape3D
\_RRWheel (VehicleWheel3D)
\_RRWheelMesh (CSGCylinder3D)
\_RRWheelSmoke (GPUParticle3D)
\_RLWheel (VehicleWheel3D)
\_RLWheelMesh (CSGCylinder3D)
\_RLWheelSmoke (GPUParticle3D)
\_FRWheel (VehicleWheel3D)
\_FRWheelMesh (CSGCylinder3D)
\_FLWheel (VehicleWheel3D)
\_FLWheelMesh (CSGCylinder3D)
\_Center_O_M
\_Camera_O_P
\_Camera3D

Script:


extends VehicleBody3D

#Variables
@exportexport var Power: floa@export = 0
@export var Max_Steer_Angle: @exportloat = 0.0
@export var Turning_Wheel_F@exportrce: float = 0.0
@export var Normal_Rear_Whee@export_Traction: float = 0.0
@export var Turning_Rea@export_Wheel_Traction: float = 0.0
@export var Drift_F@exportrce_Strength_Multiple: float = 0.0@export@export var Max_Drift_Force: f@onreadyoat = 0.0
@export var Break_Forc@onready: float = 0.0
@onready var cam_o_p: Node3D@onready= $Cam_O_P
@onready var camera_3d: Camera@onreadyD = $"../Camera3D"
@onready var rr_wheel:@onreadyVehicleWheel3D = $RRWheel
@onready var rl@onreadywheel: VehicleWheel3D = $RLWheel
@onready@onreadyvar fr_wheel: VehicleWheel3D = $FRWheel
@onready var fl_wheel: VehicleWheel3D = $FLWheel
@onready var rr_wheel_smoke: GPUParticles3D = $RRWheel/RRWheel_Mesh/RRWheel_Smoke
@onready var rl_wheel_smoke: GPUParticles3D = $RLWheel/RLWheel_Mesh/RLWheel_Smoke

func \_physics_process(delta: float) -> void:

#Steering Physics
steering = move_toward(steering, Input.get_axis("Right", "Left") \* Max_Steer_Angle, delta \* 4)

#If player is turning left, increase right rear wheel power and traction
if steering > 0 and linear_velocity.dot(global_transform.basis.z) > 0:
	rr_wheel.engine_force = Turning_Wheel_Force
	rr_wheel.wheel_friction_slip = Turning_Rear_Wheel_Traction

	#Add a force to the left side going right at high velocity for ease of drifting
	if linear_velocity.dot(global_transform.basis.z) >= 30:
		apply_force(Vector3(clamp(-linear_velocity.dot(global_transform.basis.z) * Drift_Force_Strength_Multiple,-Max_Drift_Force,0),0,0), Vector3(0,0,-1))

	#Stop the force if player is no longer at high velocity
	else:
		pass

#Reset rear right wheel power and traction values if player stops turning
else:
	rr_wheel.engine_force = engine_force
	rr_wheel.wheel_friction_slip = Normal_Rear_Wheel_Traction

#If player is turning right, increase left rear wheel power and traction
if steering < 0 and linear_velocity.dot(global_transform.basis.z) > 0:
	rl_wheel.engine_force = Turning_Wheel_Force
	rl_wheel.wheel_friction_slip = Turning_Rear_Wheel_Traction

	#Add a force to the right side going left at high velocity for ease of drifting
	if linear_velocity.dot(global_transform.basis.z) >= 30:
		apply_force(Vector3(clamp(linear_velocity.dot(global_transform.basis.z) * Drift_Force_Strength_Multiple,0,Max_Drift_Force),0,0), Vector3(0,0,1))
		

	#Stop the force if player is no longer at high velocity
	else:
		pass

#Reset rear left wheel power and traction values if player stops turning
else:
	rl_wheel.engine_force = engine_force
	rl_wheel.wheel_friction_slip = Normal_Rear_Wheel_Traction


#Engine Physics
engine_force = Input.get_axis("Backward", "Forward") \* Power

#Camera Physics
camera_3d.global_position = camera_3d.global_position.lerp(cam_o_p.global_position, delta \* 20)
camera_3d.global_rotation.y = global_rotation.y -PI\`

PS: I am aware that the drift force is applied at high velocity even if player is not accelerating, I am will tend to this issue later.

You probably should disable the local_space flag and particles should be parented to car’s body, not to wheels.

I cannot find any local_space flags in the inspector, but I have re-parented the particle instances. If there should be a local_space flag, would you know how to fix that issue? Or am I looking in the wrong place?

I meant local_cords. You said you enabled it.

It’s not really clear from your description what the issue is.

Unfortunately, disabling local cords does not solve the issue.

I am going to include a few screenshots of my project and editor, if there is anything you should know that makes this easier, please inform me.

Here’s the main scene:

Here is a visual representation of this issue:

Still need to present the problem better. What is happening vs what you expect to happen. The particles emission doesn’t follow the vehicle?

Btw the text in your editor screenshots is borderline unreadable.

Well, yes, the particles aren’t following the wheels, which is what I expected since the particle instances are children of the vehicle.

As for the text, I’ll see if I can replace the screenshots with a bigger font.

Make sure that top_level flag is disabled for particle nodes.

I am struggling to understand how, but that seems to have solved my problem.

Thank you.

If the flag is enabled, the numbers in node’s local transforms are interpreted as global.