Not quite sure why I’m getting “Cannot implicitly convert type double' to
float’” errors for the lines marked …
Any ideas?
public class myProjectile : MonoBehaviour {
Collider bullet1; // Collider passed in
float rads1;
float ForceX1;
float ForceY1;
void FixedUpdate (){
if (theTouch.phase == TouchPhase.Ended){
rads1 = Math.Atan2( targetItem.transform.position.y - bullet1.transform.position.y,
targetItem.transform.position.x - bullet1.transform.position.x); /// <- error
ForceX1 = Math.Cos(rads1)*1000.0f; /// <- error
ForceY1 = Math.Sin(rads1)*1000.0f; /// <- error
bullet1.rigidbody.AddForce (ForceX1,ForceY1 , 0.0f);
}
}
}