My current project is a 3d space simulation game in which the player has completely free movement in all directions, 'elite' style.
I'm experiencing a problem with sprites shaking the further away the player gets from postion 0,0,0. It first came to light when I downloaded the absolutely AWESOME sun flares demo by Barliesque. You can get it here;
http://www.blitzbasic.com/codearcs/codearcs.php?code=1107
In the demo it worked perfectly. When I got the code working in my game, I noticed at times the flares were shaking and even blinking in and out of view. You can see this for yourself by modifying the code in the above demo. After 'Scene = LoadAnimMesh("Media\Scene.b3d")'. Add the following line
Then modify the player controls function so the movement speed is scaled up.
Now if you run the code you'll notice (at least on my machine and another I tested it on) that the flares start jumping and shaking the further away you walk.
The program uses CAMERAPROJECT, PROJECTEDX & PROJECTEDY to determine the 2d location of the sun on the screen before placing the sprites. The x and y values returned by these functions dont 'shake'. If you print them to the screen while the program is running you can see the flares shaking uncontrollably even when the player is stationary and the values returned by the above functions are static.
I've now noticed by hud sprites, which are parented to the camera, also shake but to a lesser degree.
It only seems to become noticeable when the player moves about 10000 away from position 0,0,0.
Is there a fix for this (other than scaling my entire world down)?
or is it one of those floating point problems I keep reading about?
I'm experiencing a problem with sprites shaking the further away the player gets from postion 0,0,0. It first came to light when I downloaded the absolutely AWESOME sun flares demo by Barliesque. You can get it here;
http://www.blitzbasic.com/codearcs/codearcs.php?code=1107
In the demo it worked perfectly. When I got the code working in my game, I noticed at times the flares were shaking and even blinking in and out of view. You can see this for yourself by modifying the code in the above demo. After 'Scene = LoadAnimMesh("Media\Scene.b3d")'. Add the following line
ScaleEntity scene,700,700,700
Then modify the player controls function so the movement speed is scaled up.
If KeyDown(203) Then mvx=mvx-100 If KeyDown(205) Then mvx=mvx+100 If KeyDown(200) Then mvz=mvz+100 If KeyDown(208) Then mvz=mvz-100 If KeyDown(30) Then mvx=mvx-100 If KeyDown(32) Then mvx=mvx+100 If KeyDown(17) Then mvz=mvz+100 If KeyDown(31) Then mvz=mvz-100
Now if you run the code you'll notice (at least on my machine and another I tested it on) that the flares start jumping and shaking the further away you walk.
The program uses CAMERAPROJECT, PROJECTEDX & PROJECTEDY to determine the 2d location of the sun on the screen before placing the sprites. The x and y values returned by these functions dont 'shake'. If you print them to the screen while the program is running you can see the flares shaking uncontrollably even when the player is stationary and the values returned by the above functions are static.
I've now noticed by hud sprites, which are parented to the camera, also shake but to a lesser degree.
It only seems to become noticeable when the player moves about 10000 away from position 0,0,0.
Is there a fix for this (other than scaling my entire world down)?
or is it one of those floating point problems I keep reading about?