my 3d game lags very much. And I think I don't have lots of triangles in the scene... I have the newest m3 Mac and I don't think it should be the case. I run much bigger scenes with lots of objects that didn't lag at all 🙁
that's basically all I have in that scene...
Just curious, why your scene have relatively large number of drawcalls?
Also I won't call 100000k triangles 'not much' -.-
but why so many draw calls? These trees are super low poly...
Have you made sure there's nothing in process
that might be triggering? It makes me think that something is repeating in your scene that shouldn't be. Are these items pre-rendered (as in a scene in the editor) before you load or are they instanced when the scene loads?
this is in the process:
`func _process(delta):
growstate += delta / 100
if type == "tree":
if growstate < 1:
$mesh.scale = Vector3(growstate,growstate,growstate)
if main.hapiness < 100:
main.hapiness += delta / 10
if growstate > 0:
if plantready == true:
return
$mesh/mesh.modulate = Color(0,0,0,0)`
adding a tree or pot to the scene:
func addpot(position,type,data):
if type == "tree":
print("yup")
for j in range(potdata.size()):
print("yup2")
if potdata[j][1] == position:
print("yup3")
if potdata[j][2] == "pot":
for h in range(potdata.size()):
if potdata[h][2] == "tree":
if potdata[h][1] == potdata[j][1]:
message("there is already a plant in this position!",position)
return
potlist(position,type,data)
return
message("you need to place the pot first!",position)
elif type == "pot":
if position.y == 0:
for k in range(potdata.size()):
if potdata[k][2] == "pot":
if potdata[k][1] == position:
return
potlist(position,type,data)
you can plant them when the game runs - they are instanced
instancing plants:
func potlist(position,type,data):
var i = potdata.size()
var inst = load("res://game/objects/plants/plantmaster.tscn").instantiate()
potdata.append([null,position,type,ids,data])
inst.createPlant(potdata[i][4])
inst.position = round(potdata[i][1] + Vector3(0,0,0)) + Vector3(0,0.5,0.5)
inst.set_name(str(potdata[i][3]))
inst.type = type
inst.data = data
$flowerpots.add_child(inst)
potdata[i][0] = $flowerpots.get_node(str(ids))
I fixed the issue... kinda... Each tree had 4 gpuparticle children which were turned off. but even when they were turned off they caused lag? idk why really.
© 2022 - 2024 — McMap. All rights reserved.