Unit Selection

Blitz3D Forums/Blitz3D Beginners Area/Unit Selection

Nathaniel(Posted 2006) [#1]
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.


b32(Posted 2006) [#2]
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()


Moraldi(Posted 2006) [#3]
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...


Nathaniel(Posted 2006) [#4]
Thanks guys; I'll try this out.


Nathaniel(Posted 2006) [#5]
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?


Moraldi(Posted 2006) [#6]
As far as I know yes it can be a field of a type


Nathaniel(Posted 2006) [#7]
Okay. Thanks for your help Moraldi.