Hi Unitymaniacs! i am working on a sports game ( handball ). the deal is to throw a ball into a goal. on the 7 meter mark acts an animated goal keeper. now everything went fine for about 2 minutes or so ... after that the physics is getting crazy. the ball flies trough all objects. i am positioning the ball at position/rotation of the camera. then i add velocity to throw the ball. Code (csharp): function throw_ball(){ ball.rigidbody.velocity = Vector3.zero; ball.rigidbody.angularVelocity = Vector3.zero; ball.transform.position = camera.main.transform.position; ball.transform.rotation = camera.main.transform.rotation; ball.transform.eulerAngles.x -= 10; // ball.rigidbody.velocity = Camera.main.transform.TransformDirection(Vector3(0,2,12)); } watch my game at action: http://www.hbl-duell2.de/~hr-konter (use demo/demo for login and password) any ideas while this works fine for some time and then getting crazy? thanks for support Stephan
I, too, could not get it to play. However, I have a suggestion. Did you try the DontGoThroughThings script on the Wiki? It has helped me with a similar issue. http://www.unifycommunity.com/wiki/index.php?title=DontGoThroughThings
I see no problems within 2 min. After the restart of a game, then the ball went crasy. But I do not point why ..... :cry:
[a possible answer] are you calling throw_ball in update? update is executed every frame. at high frame rates your velocity could increase fast. calling it in fixedupdate will execute every physics time step and will be frame rate independent.
mmmhhh .... the same level and view .... not probably. Unless the engine runs then faster (fps) .... Is that possible? I hope the answer is no.
well yes it is possible. framerate fluctuates. even on the same machine. if i have another app open in the background (or say some system process is happening) my fps most likely will be lower than if i quit that app or the process ends. anything framerate dependent would be affected. fixed update lets you avoid this by executing in a fixed time interval. so, it's independent of frame rate and always consistent. i misread the original post as adding velocity rather than just setting it. so it's probably something else in this case. tough to say without seeing more of the project.