Game Development Reference
In-Depth Information
// Compute the intermediate values of the
// dependent variables.
for(int i=0; i<2; ++i) {
newQ[i] = q[i] + qScale*deltaQ[i];
}
// Compute right-hand side values.
double G = -9.81;
dq[0] = ds*G - ds*(mu*newQ[0] + k*newQ[1])/mass;
dq[1] = ds*(newQ[0]);
return dq;
}
Recompile the Spring Simulator with the gravity term included. See how the behavior of
the spring changes.
4.
The angular acceleration of an object rolling down a ramp without slipping is given by
the following equation:
rmg
Imr
sin
q
a =
+
2
The moment of inertia for a solid cylinder is 1/2 mr 2 . The moment of inertia for a sphere
is 2/5 mr 2 . The angular accelerations experienced by the cylinder and sphere are therefore
rmg
sin
q
2
g
a
=
=
sin
q
cylinder
mr
2
+
mr
2
3
r
1
2
rmg
sin
q
5
g
a
=
=
sin
q
sphere
mr
2
+
mr
2
7
r
2
5
Since the sphere has the lower moment of inertia, it will have the higher angular accel-
eration and will reach the bottom of the ramp first.
 
Search WWH ::




Custom Search