//System.out.println("tangentialForceAtHook="+tangentialForceAtHook);
double slingAngleWithHorz = sling_.getAngleWithHorz();
forceFromHook_.set(-cos(slingAngleWithHorz), sin(slingAngleWithHorz)); //sin(PI - angle), -cos(PI + angle));
forceFromHook_.scale( tangentialForceAtHook * sin(slingAngle));
Vector2d gravityForce = new Vector2d(GRAVITY_VEC);
gravityForce.scale(projectile_.getMass());
forceFromHook_.add(gravityForce);
// also add a restoring force which is proportional to the distnace from the attachpoint on the sling
// if we have not yet been released.
Vector2d restoreForce = sling_.getProjectileAttachPoint();
restoreForce.sub(projectile_.getPosition());
restoreForce.scale(100.0);
forceFromHook_.add(restoreForce);
projectile_.setForce(forceFromHook_, timeStep);
} else {
Vector2d gravityForce = new Vector2d(GRAVITY_VEC);
gravityForce.scale(projectile_.getMass());
projectile_.setForce(gravityForce, timeStep);
}
// at the time when it is released, the only force acting on it will be gravity.