Offscreen Tracking

Blitz3D Forums/Blitz3D Beginners Area/Offscreen Tracking

Hi guys, I'm new here and this is my first post! :-D

I'm trying to create a simple soccer game. The camera is focused on the location of the ball, and sometimes it gets to a spot where there are no user-controlled players are. So I need a system that tracks where the user-controlled players are offscreen. I'm sure you guys have some idea about this, you know those little arrows at the edge of the screen pointing the relative position of player?

I have no idea how to do this, and CameraProject seems to only work for objects onscreen. Any help?

Thanks a lot in advance!

You can use some simple if < and > commands. This is English programming below:

if player is behind camera by 1, put and arrow here
if player is behind camera by 2, put and arrow here
...

AJ00200

you could have an arrow that points at the player... basic example

Graphics3D 640,480,0,2
HidePointer()
cam = CreateCamera()
TurnEntity cam,30,0,0


pointer = CreateSphere()
PositionMesh pointer,0,1,0
MoveEntity pointer,0,-4,10
ScaleEntity pointer,1,.1,2
RotateMesh pointer,90,0,0

sphere = CreateSphere()

plane = CreatePlane()
MoveEntity plane,0,-5,0
EntityColor plane,0,0,255
EntityAlpha plane,.5
mir = CreateMirror()
MoveEntity mir,0,-5,0

lit = CreateLight()
TurnEntity lit,90,0,0

SetBuffer BackBuffer()

While Not KeyDown(1)
Cls
PointEntity pointer,sphere
PositionEntity sphere,(MouseX()-320)/20.0,-4,(-MouseY()/40.0) + 9

UpdateWorld()
RenderWorld()

Flip
Wend
End


Hey thanks a lot guys! You're idea was great Nate, I'll try it out!

ok thanks... I know what you were originally trying to do but I cant figure that out either :p but many popular games use an arrow that points at the player as well so im sure it will be fine

Your going to need to do some basic Trig. Use the atan() function to find the angle. Atan(distance away from screen edge X /distance away Y) Add that to the sides angle (top=0, right=90, bottom=180, left=270) and that will give you the angle.

Can anyone explain this better??

Maybee its normal tan()

Didn't the 'camera' in 'Kick off' just follow the player closest to the ball?