# A few Sphere questions.

So, the hospital stay starts tomorrow and I really want to spend the free time productively, so I’ve been looking for some answers to 3D trig problems, and it’s possible I’ve found them, but I’m really crap with math notation, I don’t understand all the symbols. Of course it’s possible the wifi will be terrible and I wont see any replies anyway, but here goes.

So I’m looking for answers to the following:

A way to check if an object is inside/outside a sphere. I’ve got this working using a bounding sphere without an object, but I think there must be a less expensive way.

If an object is deemed to be at the edge of a sphere, how to move it’s location to the absolute opposite of the sphere.

And then camera work, I have an idea for a game where you fly through an asteroid field. I think keeping the camera at 0,0,0 and moving all the objects will work better than the other way around as I wont be worried about location numbers escalating. I’ll need some good documentation for pitch, yaw etc, and how to move objects around the camera according to the camera angle.

If anyone could please link me some reading material or examples I would appreciate it so much.
Thank you.

Vector3 v3 = Sphere.Position (the center of the sphere) - Object.Position

Object.Position += 2*v3

And then camera work, I have an idea for a game where you fly through an asteroid field. I think keeping the camera at 0,0,0 and moving all the objects will work better than the other way around as I wont be worried about location numbers escalating. I’ll need some good documentation for pitch, yaw etc, and how to move objects around the camera according to the camera angle.

This way you have to change the location of all objects each frame. I would recommend doing the opposite and only changing the position of the camera. The time it takes until you have limitations because you use floats is very very large, but you can combat that easily by moving ALL the objects and the camera at certain thresholds.

In theory, should you determine that the precision is not good enough when the camera is at point 10 million (or something probably much much larger in x-directions), you can at this point move EVERY OBJECT AND THE CAMERA -10 million in x-direction.