Access to the position of the game object from native extension

Can we get/set position of the particular gameobject from native extension?

2 Likes

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.

1 Like

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?

1 Like

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 Like

+1