3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1]

Author Topic: 3D Objects Screen Location  (Read 648 times)

11Dogs

« on: July 27, 2011, 02:22:33 PM »
How can I take a 3D Object (such as a person) and from the camera tell the 2D screen location? Ignoring depth and so forth?

Is this even possible?
« Reply #1 on: July 27, 2011, 02:37:30 PM »
Yes! You can!

Code: [Select]
i3DLocationToScreen(Vector3,Vector3,OBJ_X)
   Vector3 = screen location. Return data.
             Resulting coordinates specify a screen location using
             the same convention used for iObjectLocationSet()
             when the object is a Sprite, a ValuePrint or a TextPrint object.
             NOTE: if the source 3d location is outside the viewing
             frustum returned 2d coordinates will be outside the screen.
             NOTE: if the source 3d location is behind the camera,
             returned 2d coordinates will be both 1000000000.
   Vector3 = source 3d location to convert to screen coordinates.
   OBJ_X = camera object to be used as a reference.

What's it for?
Rocket Rumble, a 3D Rad puzzle game:
http://www.3drad.com/forum/index.php?topic=9896.0

11Dogs

« Reply #2 on: July 27, 2011, 02:45:03 PM »
Thanks!  :)

Well, I had an idea of putting player names or whatever else above a player. Maybe by attaching an eventonlocation and an if statement I could make the name appear when you are a certain distance away from an object. After getting the screen location of the object I want to display a sprite and text above the player/object. Make sense?
« Reply #3 on: July 28, 2011, 01:17:40 AM »
Yeah, kinda.
Rocket Rumble, a 3D Rad puzzle game:
http://www.3drad.com/forum/index.php?topic=9896.0

11Dogs

« Reply #4 on: July 28, 2011, 02:36:40 PM »
I feel stupid now... just looking through the Script_function_usage_examples folder and found basically the exact thing I want to do. Sorry I wasted your time. ;D
« Reply #5 on: July 29, 2011, 01:41:48 AM »
That's okay. I need to do something to kill time. Why not help fellow 3DRad members?
Rocket Rumble, a 3D Rad puzzle game:
http://www.3drad.com/forum/index.php?topic=9896.0
Pages: [1]