This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

My problem comes when I try spawning a Scene that is a rigidbody with a 3d collider and a 3d mesh in a Spatial node inside de "world" node. It lags....

I saw some tutorials about pre loading your 2d particle materials, but I could not find such a tutorial for 3d models and it materials, I am new with godot, so I am trying to understand it, but alone I can't.

Godot version 3.2.3
in Engine by (33 points)

I replied to a similar question recently. There's a video of Bastian on the subject: https://www.youtube.com/watch?v=Cg4ZT6X0ghs

I tried it, but it still hickup.... Maybe I did wrong, but I tried so many times.

The code I use is

(in the player script)

var projectile = preload("res://GameObjects/Entities/placeholdershoot.tscn")
onready var playershoots = gettree().getroot().getnode("World/Player_shoots")

the input function call the shoot function whenever mouse1 is pressed

func Shoot()
playershoots.addchildbelownode(playershoots, projectile.instance(), true) ( I also tries with playershoots.add_child(projectile.instance()))
and also, I need to instanciate every time I shoot, because otherwise it will spawn only one at time.

1 Answer

+1 vote

The hiccup will always be present while Godot uses OpenGl. It's due to the fact that openGL will compile the material shader of your objects the first time they are shown.

What you can do is render those material on a very small mesh. That way the mesh is not visible to the player. With that technique, you know exactly when the hiccup will happen, and you can maybe hide it behind a loading screen. This will avoid small hiccups the first time you instance a bullet or a particle for example.

by (643 points)

In fact, did this happen every time I spawn the object in my scene...

I could repare it, I was using a sphere mesh from godot, and lowering the standtard 64 and 32 subdivisions I could get rid of the ridcup... But I am not sure if this issue can be a tuff problem in the future of my project

But your solution it's what I did before.

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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.