is Pivot in camera view ?
Blitz3D Forums/Blitz3D Programming/is Pivot in camera view ?
| ||
| Hi ! How I can know if a Pivot (create with createpivot() ) is in Camera view ? I try EntityInView but it doesn't work with a pivot ? ? ? How I can ido ? thank |
| ||
You could use
Function SafeEntityInView(Cam, Ent)
EntX# = EntityX(Ent, True)
EntY# = EntityY(Ent, True)
EntZ# = EntityZ(Ent, True)
CameraProject(Cam, EntX, EntY, EntZ)
ScreenX = ProjectedX()
ScreenY = ProjectedY()
if (ScreenX >= 0) and (ScreenY >= 0) and (ScreenX < GraphicsWidth()) and (ScreenY < GraphicsHeight()) then
return True
else
return False
end if
end function
Obviously you should store the GraphicsWidth and GraphicsHeight in some global variables so the functions do not have to called everytime. Especially if this function is called often. yinch'03 |
| ||
| thank |