Game Development Community

3d -> 2d Positions. Almost......

by Cinder Games · in Torque Game Engine · 07/23/2005 (3:45 pm) · 5 replies

I've searched and found nfo on DGLPointtoscreen... and the Project and Unproject. I've tried for a few hours to get any of these to work to no avail, i've got it to return strange values.. but clearly not what they should be.

So i need someone to hold my hand and help me.

i want to feed a function XYZ coords an get XY back so i can use it to position a GUI target indicator. When i tried to make my own console functions i ran into issues of variable mismatches and other confusing stuff. I'm no C++ expert so it's easy for me to not know what i'm doing. I wanted to research Project() a little more.. but it's impossible to search for that on the site... since it doesn't include the ().

So... can anyone help me by providing a link to something that may help me? or perhaps someone can provide the actual code?

#1
07/25/2005 (5:57 am)
Lets try bumping this.
#2
07/25/2005 (6:00 am)
Have you looked at how the names are displayed above the characters? That is a GUI text displayed for a 3D location. Thats why the name always displays the same size and is always correctly rotated.
#3
07/25/2005 (6:07 am)
GuiShapeNameHud. I've spent all night in it tyring to modify it for what i need. but for some reason i can't seem to figure out how to make new variable for my shapebases that it will understand. I've added a new one called mTargeted. and a couple console methods to set and get the values. everything seems ok. but the GuiShapeHud is calling the same function i call from torque script and it's not getting the same values. infact it's nuts.
no where in the c++ do i have it setting the mTargeted value.. yet it's getting both false and true on different loops.

few printfs from my console.
..............
targeted
not a target
not a target
targeted
not a target
..........

using a console method to set the value doesn't seem to change how this this is working.
so i'm having a hard time getting this.
#4
07/25/2005 (6:12 am)
Here's the section of where it's retreiving the variable.

bool ShapeBase::getTargeted()
{
	if (mTargeted){
	 Con::printf("targeted");
      return true;
	}
	else if(!mTargeted){
	 Con::printf("not a target");
      return false;
	}
	else 
		return false;
}


and the call to it in the Gui script

if (shape->getTargeted()) {


it's echoing out back and forth that it's true then false or what not.
#5
07/25/2005 (12:14 pm)
Are you networking mTargeted properly?