I am new bee in Unity 3d and developing 2D game in version 4.3. I get code from googled which is move object when user swipe on screen, more fast swipe more more fast ball(2D object) move. As you can see below my code I use delta time to multiply with time instead of FPS as defined in “Unity - Scripting API: Time.deltaTime”, so I am still confuse that is jerky the issue because of multiplying with delta time. Here is my code in fixed update function.
Vector2 touchdeltaposition = Input.GetTouch(0).deltaPosition;
anglex = (float) (touchdeltaposition.x * Time.deltaTime *15.0f);
angley = (float) (touchdeltaposition.y * Time.deltaTime *15.0f);
elevationAngle = new Vector3(anglex,angley,0);
Vector3 elevation = Quaternion.Euler(elevationAngle)*transform.forward;
rigidbody2D.velocity= new Vector2(anglex,angley);
Kindly help me on this. Thanks in advance.
You can’t use deltaTime in the Fixed Update. Use the Update() method instead. Or use the fixed update time slice (Time.fixedDeltaTime) if you stay in the FixedUpdate() method. FixedUpdate is called at specific/consistent intervals, and deltaTime is the time since the last frame for the normal Update() calls which may take shorter/longer and fluctuate.
It is annoying that the reference documentation says “Use Time.deltaTime to get time since last Update method” in the FixedUpdate reference doc. I think it was just copy/paste error.
move all your camera stuff into the method, believe it or not, this resolves many camera jerk issues as the camera is only updating after all other re-positional transactions have taken place.
I recommended giving it a try at least.
you may have already visited this page but here you are in case you havent
LINK TO THE LATEUPDATE UNITY REF BELOW
btw, wtf is going on with UA atm, still no meta tools