Original Post
Hi,
I am simulating a particle travelling down a 3D inclined plane. In OpenGL you rotate about the z axis, to rotate about the y axis in spherical coordinates. The code below works as it is, but isn't it supposed to be that the YAngle, being the angle of phi (starting from the positive y axis to the negative y axis) in spherical coords is supposed to be PI/2-rYAngle, to get it to be the actual angle of the plane?
|y
|
|______x
/
/z
Here is the code for computing the normal force in 3D:
Vector4 ParticleForceUpdater::computeNormalForce(Particle *pParticle, real rXZAngle, real rYAngle)
{
real rGravity = GRAVITY_CONSTANT * pParticle->getMass();
real rNormal = rGravity * real_cos(rYAngle);
Vector4 vNormalForce;
vNormalForce.x = -rNormal * real_cos(rXZAngle) * real_sin(rYAngle);
vNormalForce.y = rNormal * real_cos(rYAngle);
vNormalForce.z = rNormal * real_sin(rXZAngle) * real_sin(rYAngle);
[color="#0000ff"][color="#0000ff"] return vNormalForce;
}
I am simulating a particle travelling down a 3D inclined plane. In OpenGL you rotate about the z axis, to rotate about the y axis in spherical coordinates. The code below works as it is, but isn't it supposed to be that the YAngle, being the angle of phi (starting from the positive y axis to the negative y axis) in spherical coords is supposed to be PI/2-rYAngle, to get it to be the actual angle of the plane?
|y
|
|______x
/
/z
Here is the code for computing the normal force in 3D:
Vector4 ParticleForceUpdater::computeNormalForce(Particle *pParticle, real rXZAngle, real rYAngle)
{
real rGravity = GRAVITY_CONSTANT * pParticle->getMass();
real rNormal = rGravity * real_cos(rYAngle);
Vector4 vNormalForce;
vNormalForce.x = -rNormal * real_cos(rXZAngle) * real_sin(rYAngle);
vNormalForce.y = rNormal * real_cos(rYAngle);
vNormalForce.z = rNormal * real_sin(rXZAngle) * real_sin(rYAngle);
[color="#0000ff"][color="#0000ff"] return vNormalForce;
}