void Movement() //For movementInput as Rigidbody
{
float MoveInputX = Input.GetAxisRaw("Horizontal");
float MoveInputZ = Input.GetAxisRaw("Vertical");
Vector3 MoveVelocity = new Vector3(MoveInputX, 0, MoveInputZ);
MoveVelocity = MoveVelocity.normalized * moveSpeed * Time.deltaTime;
rb.MovePosition(transform.position + MoveVelocity);
}
void Dashing()
{
if (Input.GetKeyDown(KeyCode.Space))
{
currentDashTime = 0.0f;
}
if (currentDashTime < maxDashTime)
{
moveDirection = new Vector3(0, 0, dashSpeed);
currentDashTime += dashStopSpeed;
}
else
{
moveDirection = Vector3.zero;
}
rb.MovePosition(moveDirection * Time.deltaTime);
}
What is dashstopspeed related to?
I think there must be a Time.deltatime somewhere with increasing currentDashTime