- Home /
How can i make my object like bouncy on finger move?
Hello Everyone actually i making 1 game like ball will go bounce in Y direction like we have to swipe and ball will come automatically down then agin we will move our finger to move ball in Y direction....
I am using gravity -1 in y direction`void Update () { if(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved) { //ball.rigidbody.isKinematic = false; //ball.rigidbody.useGravity = true;
Vector2 touchDeltaPosition = Input.GetTouch(0).deltaPosition;
ball.transform.Translate(0,touchDeltaPosition.y *speed * Time.deltaTime,0);
//cam.transform.Translate(touchDeltaPosition.x * speed,touchDeltaPosition.y * Time.deltaTime,0);
//Debug.Log("X side value..."+touchDeltaPosition.x * speed);
Debug.Log("Y Value...."+touchDeltaPosition.y * Time.deltaTime);
}
}`, or i am using code which i paste below..The problem is when i am swiping my ball in y Direction on that time it working but after some time ball coming down very fast.. I don't know why it is coming down like that?
Answer by Xtro · Aug 21, 2013 at 01:50 PM
Set the collider material to Bouncy. You must install the physics materials from default unity packs.
i can not use physics material because my ball is not colliding with any collider i am swiping my ball on the base of my finger swipe....The main problem is its looking like gravity in -y direction is going high after some time but when i am printing value of gravity it's co$$anonymous$$g fine..
Your answer
Follow this Question
Related Questions
Gravitational pull without losing speed 1 Answer
RigidBodys Suddenly Heavier 1 Answer
Turn Gravity on when collision occurs 1 Answer
Gravity inside a space ship 1 Answer
Rigid body speed not increasing. 1 Answer