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

Function Script_SetPosition

engine/gameobject/src/gameobject/gameobject_script.cpp:993–999  ·  view source on GitHub ↗

sets the position of the game object instance * The position is relative to the parent (if any). The global world position cannot be manually set. * * @name go.set_position * @param position [type:vector3] position to set * @param [id] [type:string|hash|url] optional id of the game object instance to set the position for, by default the instance of the calling script

Source from the content-addressed store, hash-verified

991 * ```
992 */
993 int Script_SetPosition(lua_State* L)
994 {
995 Instance* instance = ResolveInstance(L, 2);
996 dmVMath::Vector3* v = dmScript::CheckVector3(L, 1);
997 dmGameObject::SetPosition(instance, dmVMath::Point3(*v));
998 return 0;
999 }
1000
1001 /*# sets the rotation of the game object instance
1002 * The rotation is relative to the parent (if any). The global world rotation cannot be manually set.

Callers

nothing calls this directly

Calls 4

ResolveInstanceFunction · 0.85
CheckVector3Function · 0.85
SetPositionFunction · 0.70
Point3Class · 0.50

Tested by

no test coverage detected