Godot Version
4.4
Question
Hi, I have a simple polygon model with an animation and I’m spawning in about 500 of them, this runs poorly on a well specced PC (Ryzen 7 7800x3d, 4070).
The script on this model is a simple state machine that just calculates some random movement via:
func PhysicsUpdate(_delta: float):
var forward_motion: Vector3 = move_direction * fish_context.move_speed
fish_context.fish.velocity = forward_motion
fish_context.fish.move_and_slide()
animation_player.play(swim_animation_name)
for i in fish_context.fish.get_slide_collision_count():
var collision: KinematicCollision3D = fish_context.fish.get_slide_collision(i)
if collision:
move_direction = -move_direction
is_bouncing = true
bounce_time = 0.01
break
What are some techniques I can do to optimise this object and make it way more performant? Should I reduce the poly count even more, limit the animation? Are there any programming techniques to run these objects efficiently?
Thanks.