0 votes

Hey dear fellow godot people!
So my question is as follows:
Imagine you have a bullet with the size (1,1,1) and build the mesh that its facing upwards. Now you wanna rotate the whole construct but rotating the root node has no effect as well as scaling the root node has no effect. Yeah of course you could rotate or scale it later on BUT this does require a bit (no matter how few) performance.
Therefore : Is there a way to apply the changes made to a root node in editor to the final world. (Via instancing not direct placing.)

In my case the bullet consists of an area/mesh/collision shape and is instanced by a player
at a certain point.

Thank you very much for any help!!!

in Engine by (15 points)

1 Answer

0 votes

I can't understand exactly all your question...
You have something like this?

var NewBullet := preload(path_to_bullet_scene)

func _unhandled_key_input(event: InputEventKey) -> void:
if Input.is_action_just_pressed("shoot"):
    var new_scale: Vector2 = Vector2(...)
    var bullet = NewBullet.instance()
    bullet.scale = Vector2(new_scale)
    bullet.rotation =...

but you want to optimize performance 'cause instance + change scale/rotation + add_child takes performance?

I have this issue with unity (and the memory spike) making a bullet hell game
My aproach was to make an object pooling
But in godot I think is not so "simple" (most of the trouble is you have to handle all the scene you are preloading), not impossible, but harder.
I think this is a good answer about object pooling

by (164 points)

Hello there!
At first thank you for your answer!!!
Secondlly this concpet solves my problem only partly :
I wanted to rotate/scale a scene in editor (by rotating or scaling the root node) . This change shold have effect to the instance while in game. Though it has no effect and these properties have to be set manually in runtime so far. This consumes processing therefore i wanted to know if there is a way to apply editor properties.
(E.G. if you scale a scene in its own editro to 100,100,100 and instance it via code it will have the size 1,1,1 -> only if you resize child nodes of your scene it would have any effect)

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.
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 webmaster@godotengine.org with your username.