Can we get/set position of the particular gameobject from native extension?
No, not at the moment. It would be quite useful though for certain kinds of extensions. @Mathias_Westerdahl I think we’ve discussed this in the past right?
You could of course call the go.get_position() and go.set_position() Lua functions from your extension but that would add some overhead compared to the functionality being provided from the Defold NE SDK.
We’ve only briefly talked about it.
Having those functions in an extension could indeed be useful, but could possibly also mess with the update cycle.
I think it needs some careful consideration.
I think it would help to also know more about the actual use case?
My case is simple. I don’t want to generate unnecessary garbage every time get_position/get_world_position
is called.
So, I think to implement custom get_position/get_world_position
functions which return three floats
, not a vector3
. And the custom set_position
, again with three arguments.
+1
It seems to me that now a gameobject position can be get from a native extension. But can the position be set in a native extension?
dmGameObject::SetPosition()
: