Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - AGP

#1516
Support / Re: A Little Trigonometry
June 05, 2009, 10:07:02 AM
No, that's what it ought to look like. The cars are moving on the X/Y plane with +Z going up. And, like I said, the car is following the tracks nicely.
#1517
Support / Re: A Little Trigonometry
June 05, 2009, 09:56:03 AM
Sorry, I forgot to tell you that the first 4 bytes are an int that informs us how many SimpleVectors (not floats) are stored.
#1518
Support / Re: A Little Trigonometry
June 05, 2009, 09:36:24 AM
I e-mailed it to you. It's not an ASCII, but all you need is DataInputReader to read the floats.
#1519
Support / Re: A Little Trigonometry
June 05, 2009, 01:11:59 AM
Egon, what kind of a problem could the direction markers have? I store the center of my car and the opponent car follows the markers perfectly.

And paulscode, thanks for the tip, but on a PC (where performance differences won't be that significant) isn't that a little bit overkill?
#1520
Support / Re: A Little Trigonometry
June 04, 2009, 09:22:18 AM
If you mean something like the following, it didn't do it for me either.

opponentCar.setRotationMatrix(rails[currentDirectionMarker].getRotationMatrix());
#1521
Support / Re: A Little Trigonometry
June 04, 2009, 08:39:30 AM
Thanks for the blitting suggestion, I'm about to try it out. But yes, it's really an animated gif I want drawn (but at this point I'll settle for a static one).

And no, your approach constantly rotates the car in odd angles. The closest one so far has been paulscode's latest, but even that doesn't quite do it.

And I solved the speed issue (I was working from a constantly-updated carCenter). Sorry if I waste your time sometimes, but I really try not to. This particular question took me a couple of days to ask. I think something happens with me after I ask a question (unburden myself, I suppose!) that I think more clearly. So, down to two problems. :-)
#1522
Support / Re: A Little Trigonometry
June 04, 2009, 08:06:13 AM
It's not supposed to be uneven, it sleeps 40 milliseconds, and draws. Obviously some parts of the model might take a little longer to render, but it should hardly be perceptible, and it really really is.

Egon, on yet a separate question (not to draw too much attention away from the bigger turning problem), how do I draw an image onto the buffer using the hardware renderer outside of an AWTGLCanvas? I've tried reading the lwjgl docs, but I found nothing there. I even tried looking for my C OpenGL programs of so many years ago, but I can't find them right now. Do you know?
#1523
Support / Re: A Little Trigonometry
June 04, 2009, 03:07:21 AM
I applied your change and the result is conservative (it does most of the rotation, maybe 70% of it, but never quite enough). Also, since my streets always turn left, I didn't get to test a right turn, although I supposed your applet does. Here's a quick question: why doesn't the following code produce an even speed?


float translationAmount = 72f/distance; //MOVE % OF distance THAT EQUALS 72
SimpleVector directionMoved;
directionMoved = moveTowardsMinusZ(opponentCar, rails[currentDirectionMarker], translationAmount);
//THE DISTANCE IS UPDATED WHENEVER calculateDistance(opponentCar.getTransformedCenter(), rails[currentDirectionMarker]) < 1f AND currentDirectionMarker IS INCREMENTED
//THEN THE MOVETOWARDS METHOD CALCULATES THE DELTAS:
float deltaX = (direction.x -origin.x)*translationAmount;
float deltaY = (direction.y -origin.y)*translationAmount;
#1524
Support / Re: A Little Trigonometry
June 03, 2009, 07:58:59 PM
Thanks, man, and I wish I could take credit for the model, but I bought it. :-) I'm preparing a website with a bunch of things I did over the years (since I didn't finish a lot there's a lot to do), but I'll be posting the links here as I finish them.
#1525
Support / Re: A Little Trigonometry
June 03, 2009, 06:10:41 PM
Almost right, except that I'm only rotating the car every time I increment the array index of world coordinates, as opposed to in every iteration of the game loop.
#1526
Support / Re: A Little Trigonometry
June 03, 2009, 05:54:57 PM
The world coordinates are invisible. I store them by setting the program in store mode, at which point the opponent car doesn't move and I drive in its place while my program stores my position. The rest you can see in the screenshot:
#1527
Support / Re: A Little Trigonometry
June 03, 2009, 05:45:45 PM
Egon: it's a bad thing in that the car rotates awckwardly even on straight lines. Then again, if the formula eventually works...

Paulscode: yeah, the child object is directly in front of it, but no, the car isn't using pointer to move, it's chasing an array of SimpleVectors. I put the pointer there just so I could get a triangle from which to calculate theta. And the car is moving exactly as it should except that after the first turn it's not facing forward.
#1528
Support / Re: A Little Trigonometry
June 03, 2009, 06:40:56 AM
Here's a note: while Egon's code rotates the car even on straight lines, paulscode's code doesn't. So if either of you is reading, I think that's an important observation. I'll try and get this thing working in applet form and post a link here tomorrow.
#1529
Support / Re: A Little Trigonometry
May 31, 2009, 12:04:58 AM
Yes, and it loads fine. Ever since they made appletviewer (and just to be clear I'm not using it, I'm using Explorer and Firefox) security permission-aware, I've found applet writing and testing to be a nightmare, which is why I first wrote this program as an application. But I'll solve it soon enough, I suppose. Really, my only rush is that I don't want you to go offline! :-)
#1530
Support / Re: A Little Trigonometry
May 30, 2009, 11:56:48 PM
I took it out and it doesn't even get to the OutofMemoryError, but that was a good suggestion.