Monday, 20 December 2010

Developer Journal 20


I spent a fair bit of Friday and Saturday morning working on my PC hardware to make it quieter. It's fairly quiet now. I replaced the CPU fan and the graphics card. The difficulty was that my motherboard was old and could only use AGP graphics cards. The people at my local computer store originally thought it was my power supply and replaced it only to find out that it was the graphics card and the CPU fan that were making the noise.

If you're ever in my area and you need to purchase some PC hardware, I recommend Cnet Technology.

Friday afternoon, Saturday afternoon, and Sunday were taken up by personal affairs. I've got a few hours to work today before heading out. My partner just received the fantastic news that she's receiving a PhD scholarship!

Last Thursday, I was struggling to get my graphics code to represent what's happening in my physics code without much luck. The graphics cube that represented the ground seemed to be much smaller than the physics cube so I had mini cubes floating in the air no where need the ground cube.

I'll have a look at it a bit longer and if I can't fix it, I'll need to enable the bullet physics debug rendering.

In the physics code, the ground size is 100,0,100 and the cube size is 1,1,1. So there's a 100 to 1 ratio.

In the ground code, the ground size is 1,0,1 and the cube size is 0.01,0.01,0.01. So there's a 100 to 1 ratio again.

It's so good to have a quiet PC!

So I placed a cube at -60,10,0 and let it drop. It fell for a while and then stopped in mid-air, which makes sense because that is within the physics ground size of 100,0,100 and position 0,0,0.

Somethings wrong with my graphics code.

Actually no. If the ground is at position 0,0,0 and its size is 100,0,100 then a cube at -60,10,0 should keep falling through.

I'm going to have to enable the physics debug drawing so that I figure out where it thinks all the objects are.

Ooh. The debug drawer is so pretty! I'm so glad that my friend, whom I shall refer to for the time being as AC, wrote a prototype program for me to learn from!

So there needs to be some link between the physics and the graphics code. I like to think of graphics as a service that other components call upon.

Hmm. Framelisteners remove themselves so you don't need to make then a smart pointer.

As I suspected. The objects in the physics code are much larger than the graphics code.

At least the origin of objects are the centre of objects.

So the ratios I had were correct. The only thing is that objects in the physics code are twice as big as that in the graphics code!

I don't really get it, but ok...

The ground in the physics code is size 100,1,100 and located at 0,-1,0.

The ground in the graphics code is size 200,2,200 and located at 0,-2,0.

But that doesn't seem to match up.

The ground in the graphics code seems to need to be located at 0,-1,0 to match up. Weird. I'll need better controls to navigate the 3D space in order to see what's going on.

Seems like the scaling is a factor of 2 but the position factor is the same.


Now to connect the AI to the physics and graphics.

The AI provides forces for the physics code to process.


Grr. Time to stop.

[Y] Get graphics code to properly represent the physics code.
[Y] Change the ground size from 0 height to 1 height and reposition accordingly.
[ ] Fix spatial code.
[ ] Enable shadows
[ ] Implement FPS and command controls
[ ] Check that the physics and graphics match up more closely.


[ ] A way to adjust object size, location, and orientation in real time via a GUI.

No comments:

Post a Comment