I spent some time tuning the AIPath values for an object in my game (“heat-seeking rocket”, basically), and finally got it to the point that it worked reasonably well in the editor. However, when I published the game with the web player the object moved much, much slower – maybe 1/3rd the speed – and I can’t figure out why. I’m concerned that the code may be dependent on framerate or something like that. Has anyone else run in to this issue, and if so what was your solution?
The AIPath movement is not frame rate dependent (I don’t think so anyway, hopefully I have not confused fixedDeltaTime with deltaTime somewhere…). Are there any other scripts you are using?
In AIPath.cs:
if (navController != null) { navController.SimpleMove (GetFeetPosition(),dir); } else if (controller != null) { controller.SimpleMove (dir); } else if (rigid != null) { rigid.AddForce (dir); } else { transform.Translate (dir*Time.deltaTime, Space.World); }
I think that rigid line should be in FixedUpdate or should be rigid.AddForce (dir*Time.deltaTime) or something. I moved it to FIxedUpdate and am seeing good results. What do you think?
Duh. Stupid bug.
Thanks for noticing. I have added it to my todo list for fixing.