Author Topic: Code for radar!  (Read 3226 times)

Offline Melssj5

  • double
  • *****
  • Posts: 715
    • View Profile
Code for radar!
« on: November 01, 2006, 06:31:55 pm »
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Code for radar!
« Reply #1 on: November 01, 2006, 06:43:29 pm »
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.

Offline Melssj5

  • double
  • *****
  • Posts: 715
    • View Profile
Code for radar!
« Reply #2 on: November 01, 2006, 08:38:09 pm »
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

Offline Melssj5

  • double
  • *****
  • Posts: 715
    • View Profile
Code for radar!
« Reply #3 on: November 01, 2006, 09:26:55 pm »
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

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 11748
    • View Profile
    • http://www.jpct.net
Code for radar!
« Reply #4 on: November 02, 2006, 04:56:42 pm »
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?

Offline Melssj5

  • double
  • *****
  • Posts: 715
    • View Profile
Code for radar!
« Reply #5 on: November 03, 2006, 04:46:39 pm »
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