Offscreen Tracking

Blitz3D Forums/Blitz3D Beginners Area/Offscreen Tracking

SilverCoin(Posted 2009) [#1]
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!


AJ00200(Posted 2009) [#2]
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


Nate the Great(Posted 2009) [#3]
you could have an arrow that points at the player... basic example




SilverCoin(Posted 2009) [#4]
Hey thanks a lot guys! You're idea was great Nate, I'll try it out!


Nate the Great(Posted 2009) [#5]
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


AJ00200(Posted 2009) [#6]
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??


AJ00200(Posted 2009) [#7]
Maybee its normal tan()


Andy(Posted 2009) [#8]
Didn't the 'camera' in 'Kick off' just follow the player closest to the ball?