# camera ArcCamera jumping around

## Recommended Posts

When using chains of parent objects, especially with large distances, the camera jumps all over the place:

Problem kicks in just after a distance of 10,000,000.

This could perhaps be solved by utilising https://github.com/MikeMcl/bignumber.js/

Edit: Problem occurs when there's a large differential between the size and distance when using parent objects:

##### Share on other sites

Problem is evident even when there is only one sphere:

To normalise the bug, A sphere of size 1 with distance 250k from the origin causes uncontrollable and unworkable jitter.

I'm guessing that this is a problem with the basic render engine, does anyone have any ideas?

##### Share on other sites

For comparison here is ThreeJS running with a size of 1 and a distance of 440 million from the origin. (Near upper limit)

##### Share on other sites

In the 3JS example you are just rotating the cube.

Here it is with the camera rotating around the cube:

##### Share on other sites

Thank you, yes you're right, my mistake.

So to normalise, this would be a size of 1 at a distance of 250k:

Is this just a problem with WebGL? I don't remember having it with OpenGL 3.0, when loaded through a window server.

Is it assumed that everyone will use less than 250k units?

##### Share on other sites

As a workaround to this problem, I guess I'll use the currently viewed object as the origin, and re-compute the position of other objects, using the current as an offset. (Not ideal since it'll be calculation heavy).

Another workaround would be to play with sizes and distances until I find something that works, although taking this route will likely end up giving me problems in the future.

Thank you for your help)

Edit: Relevant information here: http://stackoverflow.com/questions/14761595/three-js-objects-shimmering-at-large-distances

##### Share on other sites

So it was very simple to make the change:

``````// Each object has it's own JS position vector
// Here we assign new a mesh position based on a subtraction of
// this mesh's position and the new origin's position

// Save this object for use inside Object.each()
var that = this;

// Offset each of the meshes which belong to this object by an arbitrary position
Object.each(this.meshes, function(mesh) {
mesh.position = that.position.subtract(newOrigin.position);
});``````

Using mootools for Object.each

##### Share on other sites

whoa whoa whoa, can you go back over this really quick? something is not right there is no reason for the camera to jitter given your explanation and there should be no work around.  Ill take a look at the playground you posted and see what I can find

##### Share on other sites

ohh ok I got it... why is your camera maxZ so high?

there is no point for that, set it to something reasonable, like 100 and scale your scene from there to do the ratio or size that you want.

camera.maxZ = 10000000000000; is never going to work, in any engine.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.