0 votes

Hello,
I have an issue related to this topic:
https://godotengine.org/qa/27821/how-to-improve-gridmap-performance-octant-size?show=27952#c27952

In short, if I use a 3D GridMap with a meshlibrary composed of Meshes ONLY, the loading of the map is superquick (i´m talking about hundreds of thousands of mesh - if not millions- in a few seconds).
If I go with a meshlibrary composed of StaticBodies (i need them to detect the click of the mouse on the object placed on the gridmap), a simple 10 thousands bodies map will takes several minutes to load, a 50k bodies map will take up to 15-20 minutes.

Point is I was expecting a slow down of the performance, but one would expect adding physics objects would impact mainly on the frame rate, but that´s totally untrue: the framerate remain basically untouched.

I would like to know where this slow loading time came from, why does a static body take more time to appear on the scene than a simple mesh, even before any physic is involved?

Andrea

asked May 9, 2018 in Engine by Andrea (486 points)

i just saw an email saying you replied my post and gave me hopes that you found a solution, just to came here and read this XD

So you didn't actually read it? When I get my email from this website it shows me what comments I get too.

nah, i click the link, then read

I just had a similar problem instancing nodes with static bodies. Not sure if it applies to your case, but in mine, changing the position of the node before adding it as a child solved the problem.

var child = Child.instance()
child.set_position(Vector2(x, y))
parent.add_child(child)

I guess Godot recalculates collisions on each child added and, by default, they would stack on 0, 0, causing the lag.

This works, thank you!

 # Create many collision shapes
var collisionNode = StaticBody.new()
collisionNode.set_translation(Vector3(i * 10, 1, 1))
self.add_child(collisionNode)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.