- Home /
Question by
unity_aIyMJBzX9MObPw · Jan 04, 2021 at 10:17 PM ·
movementmovement scriptjerkyfinger
Jerky movement of the object
Hey guys,
I´m new to Unity and to this forum. So please excuse me if I do something wrong in the forum. I try to move an object on the x-axis with my fingeran on the z-axis at a fixed speed. I found instructions for this on the internet, but the object moves very jerkily.
I hope someone know a solution,
Thanks in advance
This is my code:
void FixedUpdate()
{
if (Input.touchCount == 1) {
touch = Input.GetTouch(0);
if (touch.phase == TouchPhase.Moved) {
transform.position = new Vector3(
transform.position.x + touch.deltaPosition.x * speedModifier,
transform.position.y,
transform.position.z
);
}
}
transform.position = new Vector3(
transform.position.x,
transform.position.y,
transform.position.z + (speed * Time.fixedDeltaTime)
);
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613022615im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Moving tram along rail. 0 Answers
2D Top Down Shooter: AI Ally twitching 2 Answers
Velocity is not matching the Vector3 it is assigned 1 Answer
I have a movement script, but how can i make it so i can move half the speed while in the air. 0 Answers
MoveTowards is moveing my object to random position when i click it is already on a way 1 Answer