0

first question here. Apologies if it's already been answered - I couldn't find anything through Google or on here.

My game is a space sim (with realistic inertia, continuous rotation unless stopped etc) which requires a vast, vast playable area. What is happening is that when my ship flies too far away from its starting location (around 1,000,000 in terms of Matrix.Translation's measurements) the ship or camera starts to rotate erratically. When I pay closer attention, even as soon as it starts moving from its start location there are tiny anomalies (literally one changing pixel in the edge of the 3D model for example, but the ship should be completely stationary (it has no animations) in relation to the camera. Originally I had similar problems with continuous changes to rotation causing the ship's matrix to become non orthogonal, but I solved that by converting to a quaternion for normalising purposes, then back to matrix. This problem does not seem related, and my experience at 3D programming is minimal.

Not sure which bits of code you would want to see, but I will paste them in if requested. Am I going about this the wrong way - should I have the solar system move around the ship as apposed to the ship moving around the solar system? At a loss. Please help.

Phil

1 Answers1

0

I'n not entirely sure about your question, but I think if you are making your galaxy realistic, and use floats (or doubles at some point), that is definitely your problem. See this question for more information about floating point accuracy.

As for an solution , possibly this blog post might be interesting to you, as I think it is trying to solve the same problem you are facing right now, making a space simulation game and solving accuracy problems.

Community
  • 1
  • 1
Marking
  • 754
  • 1
  • 8
  • 23
  • Marking, that pretty much hit the nail on the head. I'm going to start by having the solar system rotate around the ship, which will keep the ship's matrix almost 100% accurate, letting the accuracy of objects lessen as they fall off into the distance (which shouldn't be noticeable). I was aware of the problem of values getting rounded off more and more the greater they get :) Jack Purdum's Beginning C# does a fantastic job of explaining things like that as you learn. – Phil Ekiert Jul 21 '13 at 14:17