About TraceScreenRay()...

About TraceScreenRay()...

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
Pendrokar
Posts: 658
Joined: 30 May 2007, 10:45

About TraceScreenRay()...

Post by Pendrokar »

Is this how it supposed to be that when using Spring.TraceScreenRay(mousex, mousey, true/false) it returns three variables (x,z,y) not (x,y,z)!!! This confused me!
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

Why do you think x,z,y?

I assume it is in normal Spring world coordinate system, ie. +x in east direction, +z in south direction and +y upward, given the coordinate (x,y,z).
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Post by Kloot »

Nope, it really returns {x, y, z} (y is the
vertical dimension in Spring's coordinate
system):

Code: Select all

	lua_newtable(L);
	lua_pushnumber(L, 1); lua_pushnumber(L, groundPos.x); lua_rawset(L, -3);
	lua_pushnumber(L, 2); lua_pushnumber(L, groundPos.y); lua_rawset(L, -3);
	lua_pushnumber(L, 3); lua_pushnumber(L, groundPos.z); lua_rawset(L, -3);
User avatar
lurker
Posts: 3842
Joined: 08 Jan 2007, 06:13

Post by lurker »

MiveHind
Post Reply

Return to “Lua Scripts”