PickPoint doesn't work for me
by Andy Hawkins · in Torque Game Builder · 12/25/2006 (9:17 pm) · 2 replies
I have this code and I keep getting an error. t2dSceneGraph is not defined anywhere else in my program. I kinda assumed it was a TGB keyword. Why would I be getting the error?
error is...
function sceneWindow2D::onMouseMove( %this, %mod, %worldPos, %mouseClicks )
{
// Pick objects at mouse-point.
%objList = t2dSceneGraph.pickPoint(%worldPos); /// <----- ERROR ON THIS CALL
// Get Pick Count.
%objCount = getWordCount(%objList);
// Iterate Selected Objects from (front->back).
for( %i=0; %i < %objCount; %i++)
....error is...
Unable to find object: 't2dSceneGraph' attempting to call function 'pickPoint'
Torque Owner Joe Kauffman
You need to first get the scenegraph for your SceneWindow...
like this:
function sceneWindow2D::onMouseMove( %this, %mod, %worldPos, %mouseClicks ) { [b]// get this sceneWindow2D's scenegraph %scenegraph = sceneWindow2D.getSceneGraph(); [/b] // Pick objects at mouse-point. %objList = [b]%scenegraph[/b].pickPoint(%worldPos); /// <----- ERROR ON THIS CALL // Get Pick Count. %objCount = getWordCount(%objList); // Iterate Selected Objects from (front->back). for( %i=0; %i < %objCount; %i++) ....Best,
Joe