New Items showing up at 0 0 0, not camera pos
by Jake Callery · in Torque Game Engine · 04/06/2008 (5:15 pm) · 4 replies
Hey all,
I seem to have a bit of an issue. I just started a new project, built off of the tutorial.base example.
When I create a new shape (ItemData) in the mission editor, it shows up at 0 0 0, and not where the
camera is pointing. This is on a bone stock version of TGE 1.5.2 within the flat.mis file using flat.ter (also unmodified)
My Item datablock looks like this:
and my Create hook looks like this:
It other projects, this has never been an issue. I'm not sure what I have done wrong here.
Any insight would be greatly appreciated!
Thanks!
I seem to have a bit of an issue. I just started a new project, built off of the tutorial.base example.
When I create a new shape (ItemData) in the mission editor, it shows up at 0 0 0, and not where the
camera is pointing. This is on a bone stock version of TGE 1.5.2 within the flat.mis file using flat.ter (also unmodified)
My Item datablock looks like this:
//Object pickup Item Example
datablock ItemData(DBMyItem)
{//Datablock
category = "My Stuff";
shapeFile = "~/data/shapes/3dtorquelogo/torque_logo.dts";
};//Data blockand my Create hook looks like this:
function ItemData::Create(%db)
{//Editor Hook for create
//Switch on Datablock name
switch$(%db.getName())
{//handle different items
case "DBMyItem":
%obj = new Item()
{//make item
datablock = DBmyItem;
rotate = true;
static = true;
};//make item
echo("Item Created!");
default:
echo("Bad DB for create: " @ %db.getName());
}//handle different items
}//Editor Hook for createIt other projects, this has never been an issue. I'm not sure what I have done wrong here.
Any insight would be greatly appreciated!
Thanks!
#2
This Does NOT work:
This DOES work
Notice the only change is the removal of the echo statement... anyone care to venture a guess
on why that affects the position of the newly created item?
Very lost here...
04/06/2008 (5:38 pm)
Ok, after some more testing, this seems to be what happens.This Does NOT work:
unction ItemData::Create(%db)
{//Editor Hook for create
//Switch on Datablock name
switch$(%db.getName())
{//handle different items
case "DBMyItem":
%obj = new Item()
{//make item
datablock = DBmyItem;
rotate = true;
static = true;
};//make item
echo("Item Created!");
default:
echo("Bad DB for create: " @ %db.getName());
}//handle different items
}//Editor Hook for createThis DOES work
unction ItemData::Create(%db)
{//Editor Hook for create
//Switch on Datablock name
switch$(%db.getName())
{//handle different items
case "DBMyItem":
%obj = new Item()
{//make item
datablock = DBmyItem;
rotate = true;
static = true;
};//make item
//echo("Item Created!");
default:
echo("Bad DB for create: " @ %db.getName());
}//handle different items
}//Editor Hook for createNotice the only change is the removal of the echo statement... anyone care to venture a guess
on why that affects the position of the newly created item?
Very lost here...
#3
however if I have an echo statement in there, the position of the new object is set to 0 0 0.
Anyone else have this issue?
04/06/2008 (5:46 pm)
I seem to be able to put anything after the new Item() block, except an echo, and it works..however if I have an echo statement in there, the position of the new object is set to 0 0 0.
Anyone else have this issue?
#4
If you don't return %obj at the end, then echo will mess with the position.
I can't tell you why exactly, but putting return %obj at the end makes everything work again.
My guess is that the engine isn't getting the new object handle in a normal fashion unless it is
specifically returned to it at the end of the Create callback.
04/06/2008 (5:56 pm)
Ok, very sorry for the Brain Dump, but I have finally figured it out.If you don't return %obj at the end, then echo will mess with the position.
I can't tell you why exactly, but putting return %obj at the end makes everything work again.
My guess is that the engine isn't getting the new object handle in a normal fashion unless it is
specifically returned to it at the end of the Create callback.
Torque 3D Owner Jake Callery
is pointing.
Very strange.
Thanks again!