Rigidbody.velocity control the speed and slow down the speed with mobile platform input Like Button Handle
Rigidbody.velocity control the speed and slow down the speed, And with mobile platform input Like "Jump" button.
I would like the say, like when the ball is falling at the high way, and u press "Slow" then will slow down the ball. And the other word u press the 'speed' it will speed up the ball is falling
I hope some answer me is the (Mobile platform input Like Button Handle)
please i need the best answer and I found this one but it not work for the mobile setting platform input
var Speed: float = 0; //Don't touch this
var MaxSpeed : float = 10;//This is the maximum speed that the object will achieve
var Acceleration : float = 10;//How fast will object reach a maximum speed
var Deceleration : float = 10;//How fast will object reach a speed of 0
function Update() {
if ((Input.GetKey("left")) && (Speed < MaxSpeed))
Speed = Speed - Acceleration * Time.deltaTime;
else if ((Input.GetKey("right")) && (Speed > -MaxSpeed))
Speed = Speed + Acceleration * Time.deltaTime;
else {
if (Speed > Deceleration Time.deltaTime)
Speed = Speed - Deceleration * Time.deltaTime;
else if (Speed < -Deceleration Time.deltaTime)
Speed = Speed + Deceleration * Time.deltaTime;
else Speed = 0;
}
transform.position.x = transform.position.x + Speed * Time.deltaTime;
}
and i cannot function the, **transform.position.x = transform.position.x + Speed Time.deltaTime;*
Your answer
Follow this Question
Related Questions
UNITY no longer detecting XBOX360 controller input,XBOX 360 controller no longer working with UNITY 0 Answers
Problems with touch input. 0 Answers
Working with multiple joystick models 0 Answers
How to clear the keyboard buffer 1 Answer
Xbox One Controller triggering "submit" multiple times when 2 controllers active 1 Answer