I have noticed a bit of a difference between the physics in the editor and the physics in the iOS device. Here is the code I am using to apply a force to a ball so that it moves in the direction of the touch:
void FixedUpdate()
{
if (Input.touchCount > 0)
{
OnTap(Input.touches[Input.touchCount - 1].position);
}
if (Input.GetButton("Fire1") == true)
{
OnTap(Input.mousePosition);
}
}
void OnTap(Vector2 pt)
{
Ray ray = Camera.main.ScreenPointToRay(pt);
RaycastHit hit;
if (Physics.Raycast(ray, out hit) )
{
Vector3 kForce = KickForce(hit.point); // calculate the force and kick!
rigidbody.AddForce(kForce * forceMultiplier);//, ForceMode.Acceleration);
}
}
Vector3 KickForce(Vector3 dest)
{
Vector3 dir = dest - transform.position; // get target direction
dir.y = 0; // Zero-ize the vertical aspect
return dir.normalized * rigidbody.mass;
}
The ball moves much faster on the device as if FixedUpdate() is being called more often than in the editor. Does anyone know why this is happening?