Objects Shaking - how can I stop it?

Not sure what approach to take with this one … I’m sure someone out there has the answer … I’ve set up a virtual solar system … some of the outer planets are shaking … also starship shaking … not sure if it’s related to the scaling down of objects? … and/or … scaling down of orbit speeds? (using simple rotation scripts)

// Rotator.js
// This script allows you to rotate an object at a fixed rate of speed

var xspeed = 1.0;
var yspeed = 1.0;
var zspeed = 1.0;


function Update() {
// Slowly rotate the object around its target at speed degrees per second.
transform.Rotate(xspeed, yspeed, zspeed);
}

in the above sample some of the orbit speeds range from 0.000146 to 4.29e-05
the below script I’ve been using for cloud maps and I don’t think it’s the culprit …

// Random Rotator.js
// This script allows you to rotate an object at a fixed rate of speed
// make a public variable of t so we can adjust this via the inspector for each game object
var t = 0.1;

function FixedUpdate() {
// Slowly rotate the object around its target at speed degrees per second.

var xspeed = (Random.value);
var yspeed = (Random.value);
var zspeed = (Random.value);

xspeed = xspeed * t;
yspeed = yspeed * t;
zspeed = zspeed * t;

transform.Rotate(xspeed, yspeed, zspeed);
}

or is the shaking more likely to be related to the camera’s? … they’re predominately preset and are using mouse orbit/look scripts …

… any Ideas on how to smooth things over??

It sounds like you’re running close to the limits of single precision floating point numbers. If you have a game world which is the size of a star system, to scale, and then you try to have a camera following a spaceship, also to scale, and situated a long way from the origin, you’ll generally see a great deal of jittering. This is because floats don’t have enough precision to handle both the huge scale and the relatively tiny scale at the same time.

One way of working around this would be to have the star system’s planets and other large objects drawn by one camera, while small objects like spaceships are viewed by a separate camera which is drawn over the first. This ‘small objects’ camera is actually located close to the origin, so it gets the benefit of higher precision float values, and the ‘large objects’ camera is offset in the opposite direction to make it appear in the right place relative to the other camera.

Cheers for that … I’m not exactly sure how I’d go about doing that … (just a nooB) however it does sound like a fix!

Is it complicated to achieve?
Are there relevant learning resources for this approach?

thanks for your feedback!