MCPcopy Create free account
hub / github.com/defold/defold / Script_GetPosition

Function Script_GetPosition

engine/gameobject/src/gameobject/gameobject_script.cpp:883–888  ·  view source on GitHub ↗

gets the position of a game object instance * The position is relative the parent (if any). Use [ref:go.get_world_position] to retrieve the global world position. * * @name go.get_position * @replaces request_transform transform_response * @param [id] [type:string|hash|url] optional id of the game object instance to get the position for, by default the instance of the call

Source from the content-addressed store, hash-verified

881 * ```
882 */
883 int Script_GetPosition(lua_State* L)
884 {
885 Instance* instance = ResolveInstance(L, 1);
886 dmScript::PushVector3(L, dmVMath::Vector3(dmGameObject::GetPosition(instance)));
887 return 1;
888 }
889
890 /*# gets the rotation of the game object instance
891 * The rotation is relative to the parent (if any). Use [ref:go.get_world_rotation] to retrieve the global world rotation.

Callers

nothing calls this directly

Calls 4

ResolveInstanceFunction · 0.85
PushVector3Function · 0.85
GetPositionFunction · 0.70
Vector3Class · 0.50

Tested by

no test coverage detected