defold / defold/defold

Run-time creation of empty game objects without the need for a factory (DEF-2096)

Open
#3,811 2 comments 0 reactions 0 assignees View on GitHub
engine feature request
Dominant language
C++
Stars
6.3k
Forks
455
Avg merge
2d 2h
Merged PRs (30d)
129

Description

Forum user: "In my game I create objects at runtime that are defined by some player actions. Those objects are combination of other objects, and I use the scene graph to be able to easily manipulate them from my scripts (rotating or moving a parent instead of calculating positions for all of them, etc)"

Ragnar: "Ah ok, so it's something along the lines of spatial group management? That makes sense."

Forum user: "it will be useful to be able to create (empty) GameObjects on the fly to take advantage of the scene graph at runtime. Maybe something like factory.create_game_object([parent]) or similar"

(LINK REMOVED)(LINK REMOVED)
2016-09-07 10:15:25 (Jakob.Pogulis)
[~Björn.Ritzl] is this really a bug?

Is it possible to resolve tthis issue by having a factory that uses a game object without components and then assign these game objects to a parent once they have been created?
2016-09-07 10:16:09 (Jakob.Pogulis)
If so, could this issue be closed without action?
2016-09-07 10:27:03 (Bjorn.Ritzl)
No, this should have been a Story. Well, yes, you can solve this through a factory with an empty game object. And maybe that is the better solution to not bloat our APIs. On the other hand, a factory.create_game_object() function is not entirely unreasonable. I would suggest a brief discussion or some input from [~Ragnar.Svensson] to decide if we should close this one or not.
2016-09-07 11:26:59 (Ragnar.Svensson)
Why not turn it into:
local id = go.new([pos], [rot], [scale])

Ref: go.delete, factory.create

At least spend 1-2 hours on designing it, I think it should be pretty straightforward, implementation could be in 1 hour or so if I haven't overlooked anything.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.