Object verified in script is not accessible in engine
by Ben R Vesco · in Torque Game Engine · 03/02/2006 (1:03 am) · 4 replies
I'm using the excellent Advanced Camera resource. For the most part it is working wonderfully and my problem may not be directly related to it.
in my script I'm doing:
AdvancedCamera.cc defines a console method like this:
When I run the game I get this output on the console:
As you can see, the script code retrieved the handle on the object and isObject even returned true with that handle. However, the code in AdvancedCamera thinks it is not a valid object. There is identical code for identifying if the pass arg represents a valid object and that code is succeeding.
One additional piece of information, the code that succeeds is when I am passing in a player object and the code that fails is just an object placed in the mission.
in my script I'm doing:
%advCameraTarget = nameToID("centerTarget");
error("TargetId:" SPC %advCameraTarget @ ", and isObject() returns" SPC isObject(1414));
%client.advCamera.setTargetObject(%advCameraTarget);AdvancedCamera.cc defines a console method like this:
ConsoleMethod(AdvancedCamera, setTargetObject, bool, 3, 3, "(GameBase object)")
{
GameBase *targetObj;
if ( ! Sim::findObject(argv[2], targetObj))
{
Con::errorf("Object not found");
return false;
}
AdvancedCamera *camObj = (AdvancedCamera *) object;
camObj->setTargetObject(targetObj);
return true;
}When I run the game I get this output on the console:
TargetId: 1414, and isObject() returns 1 Object not found
As you can see, the script code retrieved the handle on the object and isObject even returned true with that handle. However, the code in AdvancedCamera thinks it is not a valid object. There is identical code for identifying if the pass arg represents a valid object and that code is succeeding.
One additional piece of information, the code that succeeds is when I am passing in a player object and the code that fails is just an object placed in the mission.
About the author
#2
03/03/2006 (9:38 am)
Oh, sorry. The random object is the octahedron that comes with the engine.new TSStatic(centerTarget) {
position = "49.5878 -173.256 60.5";
rotation = "1 0 0 0";
scale = "1 1 1";
shapeName = "~/data/shapes/markers/octahedron.dts";
};
#3
You could use a StaticShape (you need to define a datablock, and set a category in the datablock so they show up in the editor creator).
03/03/2006 (10:21 am)
Actually, the AdvancedCamera target must be a shapeBase. TSStatics are derived directly from sceneObject:SceneObject->TSStatic SceneObject->GameBase->ShapeBase->Player SceneObject->GameBase->ShapeBase->StaticShape
You could use a StaticShape (you need to define a datablock, and set a category in the datablock so they show up in the editor creator).
#4
03/04/2006 (6:09 am)
Oh sweet. Thanks for the help. That totally solved it. Right now I'm using a WayPoint and it's working wonderfully. For reference, I've changed it to this:new WayPoint(centerTarget) {
position = "50 -175 60";
rotation = "1 0 0 0";
scale = "1 1 1";
dataBlock = "WayPointMarker";
team = "0";
};
Torque 3D Owner Sebastien Bourgon