Need help 3d radar for space game

(BlasterToad) #1

Hello everyone

So far most of what I have needed to start my game has been easy to find, but I just can’t rap my head around this one. What I am building is a cockpit view space flight game, and I would like to give the player distance 3d radar since they will be navigating 3d space.

My vision is a sphere, player ship representation in the center, and then spawn other representations for actor objects with parameter enemy, neutral, ect. and maybe change color of representation based on parameter Agro eg. agro>=10 yellow, Agro >=20 red

Something like discused here:

Any suggestions?


Thanks Nines, you rcomment really helped

attached is mock up for radar for anyone interested, script is on blue sphere.

3d radar.blend (568 KB)

(Nines) #2

Take the worldPosition of each target relative to your worldPosition (target.worldPosition - own.worldPosition)
Scale that down (if your radar covers 1000m and the sphere is 1m in diameter, scale by 0.001)
Place the representative blip in the scaled localPosition relative to the center of the radar sphere
Have the radar sphere maintain a 0 0 0 worldOrientation, so blips on the radar will be relative to your facing (like a compass that always points north)

(BlasterToad) #3

Took 5 hours to get this done but your comment lead me in the right direction. First time I have ever used lists like that, plus only my 3rd day working with python. Here is the mock up I made, if you have time please look at the blue sphere in the blend file. I would like to know if my technique is up to standard, and if that script will cause me any issues.

3d radar.blend (568 KB)