Game Development Community

Obtaining 3D world coords from the camera.

by Phil Mundy · in Torque Game Engine · 08/08/2006 (7:09 am) · 1 replies

I want to be able to get an x and y coordinate for a 3d world location, relative to the camera. I am using the RTS starter kit SDK, but imagine its almost the same process as normal.

The main problem is that I'm not sure how you pass Point3F's etc into functions from the scripting.

Any help would be greatly appreciated.

Thanks.

#1
08/08/2006 (7:54 am)
Point3F's are usually passed to and from scripts as strings of 3 words (for x,y,z).

ie., "30 50 -40"

You can parse them in C++ with dSscanf and you can build them in C++ using dsprintf.

If you look at the ConsoleFunction implementation of 'setPosition' in shapeBase.cc, you can see an example of how to do it.