"Impact Radar" ala shooter, HELP!
Blitz3D Forums/Blitz3D Programming/"Impact Radar" ala shooter, HELP!
| ||
Hi all, I'm trying to implement a "radar" that tell you where is the enemy shooting to you. Really, the radar is a 3d sprite in front of the camera and the things I would like to know is how could I rotate this sprite depending of the global coordinates of your enemy and the angle in which the player is looking. For example, supposing that the radar is a arrow bitmap pointing to the top of the screen, the result should be: If your enemy is in front of you, the arrow rotation should be really small (almost 0).. If you turn 90 degreess to the right, for example, the enemy is positioning at your left, at this moment, the arrow should be rotated to the left 90 degress... I've tried a lot of ways but my results are a completely disaster.. I've tried with TformPoint but I don't know how to manager this function and, in the better option, if this function could help me to do this. Please, someone could help me? Thanks in advance! Regards |
| ||
Please explain why PointEntity() won't work for you. |
| ||
From what I understand of his description (ie. I may be misunderstanding) PointEntity won't help; the TForm commands are the way to do it, but I'm not at home so I can't explain right now how to do it. |
| ||
Calculate angle to bad guy using simple trigonometry, and then draw your radar with that angle + the Y axis rotation of the player. |
| ||
Basically the way in which the "radar" is shown is like if it was a 2D bitmap in front of you, ocupping the whole screen. It was on alpha 0 all the time excepts when a enemy is attacking you. At this moment, the radar rotates trying to show where the enemy position is, related to where the player is looking. For example, if the player is looking to the north and the enemy is shooting at his back, the way in which this situation was shown by the radar could be with a arrow pointing to the bottom of the screen. The problem with pointentity is that this function makes that one entity point to other and that's not the effect, the radar is 2D on screen (really is a 3D sprite but it is drawing as 2D) If you have played to Call of Duty you can see the effect I would to do. I don't know if I have explained the things i'm refering to, if you need a deeper explanation I could try to put a screenshot if someone says to me how could I do it. Thanks in advance! |
| ||
I'm assuming that the radar is a plan view? If you're just looking for an arrow sprite to point to where the atacking enemy is in relation to the player you could use .. Rotatesprite MySprite , deltayaw( player , enemy ) Not tested so you may have to add +90 or suchlike to the sprite rotation. Hope this helps. Stevie |
| ||
Stevie G's solution would be easiest, but it doesn't need to be a sprite. You can rotate meshes as well. Just point the arrow 'up' on the screen (so it's Z axis is pointing 'up') and then rotate the arrow mesh around it's Y axis the DeltaYaw amount. |
| ||
Thanks to all, I will try it... I'll tell you the results during the day Thanks and regards! |
| ||
A radar is easily done with a polar coordinate system. |
| ||
Very co-incidentally, I am trying to implement something very similar to Pinete in a space sim, and was brushing up on my maths in order to solve the problem. However, I had no idea about the DeltaYaw (not to mention DeltaPitch and DeltaRoll) command and it seems to be undocumented. Sorry for the newbie question, but how do you find out about all these undocumented commands which could save B3D newcomers alot of time? |
| ||
I bet you'll find them if you perform a search on this site for undocumented commands... |
| ||
Have you got the latest docs, DeltayAw is in the help system on my version of blitz3d? |
| ||
Bankie: there is no DeltaRoll command. |
| ||
Please, someone could say me where I could download the latest blitz3d docs? I have the 1.83 help files... I imagine that's not the latest?... Thanks! |
| ||
Have a look in the forum section "blitz3d updates" under "blitz3d doc packs" |
| ||
Yes Big10p, no DeltaRoll - my mistake. Thanks Matty for the info re the docs. It's a bit frustrating that I've bought BB3D very recently, yet got an earlier version of the docs with it. |
| ||
Ok, thank you Matty! :P |