Code for radar!

Started by Melssj5, November 01, 2006, 06:31:55 PM

Previous topic - Next topic

Melssj5

Hey Egon, is it okay if I use your radar implementation of the car demo on my game? I guess that I have lost all my math skills. BTW: Why dont you release a radar implementation on the next jpct release? that would be helpful! of course that the blit images, the scale, the plane must be parameters but anyway would be good.

Another question does your radar  show the relative position but on which plane are projected the plants over ZY or its relative to the car direction?

relative to car or relative to world.
Nada por ahora

EgonOlsen

Yes, use it in any way you like. The radar shows the positions of the plants relative to the car as if you would see it when looking at the car from above with the front of the car facing up...IIRC.

Melssj5

mmm, ok, so which changes must I do to make the radar show the relative positions but projected over the World XZ plane not from the car XZ Plane
Nada por ahora

Melssj5

Well, the radar worked well, my problem was getting the angle between the front of the craft and the world Z direction, but I noticed that you put it manually on the yrot variable so I did the same to avoid looking for math calcs and worked almost perfectly, but there is still one problem. When my crafts turns over the X Axis the radar dont change (expected to), but I need it to turn 180@ inmediatly when is now lookig to the oposite side. Should I also keep a variable called Xrot on the server so when it reaches 180 it rotates?

BTW: How can I rotate the radar? just by changing the initial positions of the blitted images and changing the X axis direction?

one side: width-150-X
other form width-150+X
Nada por ahora

EgonOlsen

In another thread, i've posted a possible solution to derive the angles from a rotation matrix: http://www.jpct.net/forum/viewtopic.php?t=576
Maybe that helps?

Melssj5

Well, I thought the radar was well, but I spent 2 days witha error. The error was about the angles, it always went to 270ยบ even if I change that value, after 3 days of this, I noticed that I was using =+ and not += so, that was all the stuff. Now it works well.

An advice for everyone, be carfeull with this! it sounds idiot, but anyone who is not full concentrated or with many noise arround may make this mistake and is difficult to find once written.
Nada por ahora