Unit Selection
Blitz3D Forums/Blitz3D Beginners Area/Unit Selection
| ||
| Hi all, Is there a command that tells where a 3D model is being displayed on the screen? I will use this for selecting and commanding units in an RTS game. |
| ||
| It is CameraProject. It converts a x/y/z coordinate to the x/y coordinates on screen. Use: "cameraproject camera, x, y, z", then read projectedx(), projectedy() |
| ||
camera = CreateCamera()
; This must be set for all entities you want to be pickable
EntityPickMode myentity, 2
.
.
.
; these are in your main loop
if MouseHit(1) = 1
CameraPick(camera, MouseX(), MouseY())
PickedEnt = PickedEntity()
if PicketEnt = myentity
; do what ever you want to do
end if
End IF
.
.
.
I hope this help... |
| ||
| Thanks guys; I'll try this out. |
| ||
| If PickEnt = myentity Is "myentity" a entity that was loaded before the "camera = CreateCamera()"? If so can "myentity" be a entity (variable) in a type? |
| ||
| As far as I know yes it can be a field of a type |
| ||
| Okay. Thanks for your help Moraldi. |