I’m not sure why the function below yields this error. It seems to happen because of the *0.5 … Is it not possible to multiply the sum by a decimal?
error CS0266: Cannot implicitly convert type double' to float’. An explicit conversion exists (are you missing a cast?)
/*
* Function: sliderPercentage
* returns percentage on transform *t* that we hit with point *p*
*/
float sliderPercentage(Transform t,Vector3 p,Vector3 dir){
return (Vector3.Dot(dir,p) - Vector3.Dot(dir,t.localScale)*0.5 + Vector3.Dot(t.position, dir)) / Vector3.Dot(dir,t.localScale);
}