Movement no longer working when adding CPU particle node

Godot Version

4.2.1

Question

Ahoy! I’m somewhat new to using Godot, but I’m coming across a weird issue that I’m unsure of how to fix.

I am making a simple top down 2d space shooter, where the ship angle lerps to the direction of the the cursor (using lerp_angle()), and left clicking creates thrust towards that direction. It works, except when I try to add a CPU particle node to my ship as a child node (to create an exhaust effect). The lerp angle still works, but the forward thrust no longer works. Removing the particle node returns movement to normal.

The cpu particle node is a child of the main ship node, rigidbody2d.

extends RigidBody2D

# forward thrust amount
var impulse_strength = 100

# lerp angle variables
var from = 0.0
var to = 0.0
var angle_weight = 0

func _process(delta):
	angleController(delta)
	thrustController()
		
func angleController(delta):
	var pos = self.position
	var mouse = get_global_mouse_position()
	var angle_dif = (mouse - pos).angle()
	from = rotation
	to = angle_dif
	angle_weight = min(angle_weight + delta * 10, 1.0)
	self.rotation = lerp_angle(from, to, angle_weight)

func thrustController():
	if Input.is_action_pressed("thrust_forward"):
		print("thrusting!")
		var angle = self.rotation
		self.apply_force(Vector2.RIGHT.rotated(angle) * impulse_strength)
		

Moving the thrustControllers() and angleController() methods to physics_process fixed this.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.