static int set_rotation(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); GameObject obj = (GameObject)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name rotation"); } else { LuaDLL.luaL_error(L, "attempt to index rotation on a nil value"); } } Transform transform = GameObjectUtil.GetGameObjTransform(obj); var rotation = transform.rotation; LuaScriptMgr.SetQuaternionFromLua(L, 3, ref rotation); transform.rotation = rotation; // var rotation = obj.transform.rotation; // LuaScriptMgr.SetQuaternionFromLua(L, 3, ref rotation); // obj.transform.rotation = rotation; //obj.transform.rotation = LuaScriptMgr.GetQuaternion(L, 3); return(0); }
static int set_localPosition(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); GameObject obj = (GameObject)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name localPosition"); } else { LuaDLL.luaL_error(L, "attempt to index localPosition on a nil value"); LuaScriptMgr.Instance.CallOnTraceBack(); } } Transform transform = GameObjectUtil.GetGameObjTransform(obj); var pos = transform.localPosition; LuaScriptMgr.SetVector3FromLua(L, 3, ref pos); transform.localPosition = pos; // var pos = obj.transform.localPosition; // LuaScriptMgr.SetVector3FromLua(L, 3, ref pos); // obj.transform.localPosition = pos; //obj.transform.localPosition = LuaScriptMgr.GetVector3(L, 3); return(0); }
static int set_localScale(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); GameObject obj = (GameObject)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name localScale"); } else { LuaDLL.luaL_error(L, "attempt to index localScale on a nil value"); } } Transform transform = GameObjectUtil.GetGameObjTransform(obj); var localScale = transform.localScale; LuaScriptMgr.SetVector3FromLua(L, 3, ref localScale); transform.localScale = localScale; // var localScale = obj.transform.localScale; // LuaScriptMgr.SetVector3FromLua(L, 3, ref localScale); // obj.transform.localScale = localScale; //obj.transform.localScale = LuaScriptMgr.GetVector3(L, 3); return(0); }
static int set_parent(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); GameObject obj = (GameObject)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name parent"); } else { LuaDLL.luaL_error(L, "attempt to index parent on a nil value"); } } if (LuaDLL.lua_isnil(L, 2)) { Transform transform = GameObjectUtil.GetGameObjTransform(obj); transform.parent = null; //obj.transform.parent = null; } else { Transform transform = GameObjectUtil.GetGameObjTransform(obj); GameObject arg0 = (GameObject)LuaScriptMgr.GetUnityObject(L, 3, typeof(GameObject)); Transform transform_Arg0 = GameObjectUtil.GetGameObjTransform(arg0); transform.parent = arg0 != null ? transform_Arg0 : null; //obj.transform.parent = arg0 != null ? arg0.transform : null; } return(0); }
static int set_forward(IntPtr L) { object o = LuaScriptMgr.GetLuaObject(L, 1); GameObject obj = (GameObject)o; if (obj == null) { LuaTypes types = LuaDLL.lua_type(L, 1); if (types == LuaTypes.LUA_TTABLE) { LuaDLL.luaL_error(L, "unknown member name forward"); } else { LuaDLL.luaL_error(L, "attempt to index forward on a nil value"); } } Transform transform = GameObjectUtil.GetGameObjTransform(obj); var forward = transform.forward; LuaScriptMgr.SetVector3FromLua(L, 3, ref forward); if (!forward.IsZero()) { transform.forward = forward; } // var forward = obj.transform.forward; // LuaScriptMgr.SetVector3FromLua(L, 3, ref forward); // if(forward != Vector3.zero) // obj.transform.forward = forward; //obj.transform.forward = LuaScriptMgr.GetVector3(L, 3); return(0); }