Camera targeting system

I wanted to integrate a camera centered targeting system like Skyrim and wanted advice for how to go about it. I was thinking that for each projectile attack I would instantiate a unique seek target added at some far off distance in the center of the camera area and for each projectile, bind it to its unique seek target. Is there an easier way to do this? Do I just have to pass a ton of messages back and forth so the projectiles know which target they’re following?

do you know python? that would make it easier.


import bge

cont = bge.logic.getCurrentController()
scene = bge.logic.getCurrentScene()

camera = scene.objects["PlayerCamera"] # or whatever the camera name is put here
empty = scene.objects["PlayerEmpty"] # or whatever the object is called where the projectile should spawn

range = 60

#rayCast(to pos, frompos, distance, property...)
topos = camera.position+camera.getAxisVect([0,0,-1])
checkray = camera.rayCast(topos,None,range,"enemy")

if checkray[0] != None:
projectile_life = 60*5
projectile = scene.addObject("Projectile",empty,projectile_life) #this spawns the Projectile

#change projectile tracking object
track = projectile.actuators["track"]
track.target = checkray[0] #not sure if its track.target or something else