T3D Pro 1.1 - window pixel --> ray calculation [RESOLVED]
by Keith G Wood · in Torque 3D Professional · 04/03/2013 (5:17 pm) · 2 replies
This references a section of html documentation which comes with T3D - under: Scripting --> Advanced --> RTS Prototype --> 2.2 Mouse Click Reaction.
This contains a sample code:
function PlayGui::onRightMouseDown(%this, %pos, %start, %ray)
I am interested in how this "%ray" parameter is derived? I have searched both script & engine code & can't find where it is done - can someone please point me at it?
Presumably it takes the clicked pixel position in the window, derives deviation from window centre (I'm assuming based on window size & fov?) adds this to the camera's direction to get the resultant direction in which the click is "looking"?
This contains a sample code:
function PlayGui::onRightMouseDown(%this, %pos, %start, %ray)
I am interested in how this "%ray" parameter is derived? I have searched both script & engine code & can't find where it is done - can someone please point me at it?
Presumably it takes the clicked pixel position in the window, derives deviation from window centre (I'm assuming based on window size & fov?) adds this to the camera's direction to get the resultant direction in which the click is "looking"?
About the author
The perverse mind behind Bad Taste Software: http://www.badtastesoftware.co.uk
Associate Chris Haigler
Jester Dance
The GameTSCtrl::onRightMouseDown() method calls GameTSCtrl::makeScriptCall().
GameTSCtrl::makeScriptCall() creates the "pos" "start" and "ray" params and calls the onRightMouseDown() script function with those params.