This is how my game looks so far:
I feel the physics are off. The ball is just instantly slowing down instead of flying across that floor.
You can see the drag is turned down so I don't know why the physics look so bad?
Any ideas? The scale is like 3x smaller than a 1x1 cube.
In case it's a script problem, here is the code on the physics I've done to move the player (note: the GIF does not contain any player input at all):
using UnityEngine;
using System.Collections;
public class PhysicsBall : MonoBehaviour {
public float speed;
private Rigidbody rb;
public float maxStamina; // from the editor
public float staminaReconveryRate; // from the editor
public float staminaDrainRate; // from the editor
public float joystickDeadband; // from the editor
private float currentStamina;
public float nothing;
void Start ()
{
rb = GetComponent<Rigidbody> ();
currentStamina = maxStamina;
}
// Update is called once per frame
void FixedUpdate () {
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
// Make sure the player actually ask to move; this is done to avoid spending stamina when
// not expecting it
bool hasHorizontal = false;
bool hasVertical = false;
if ( Mathf.Abs( moveHorizontal) > joystickDeadband )
hasHorizontal = true;
else
moveHorizontal = 0.0f;
if ( Mathf.Abs( moveVertical ) > joystickDeadband )
hasVertical = true;
else
moveVertical = 0.0f;
// player requests to move
if ( hasHorizontal || hasVertical )
{
// and has stamina
if (currentStamina > 0.0)
{
// lets move him and consume stamina
Vector3 movement = new Vector3 (moveHorizontal, 0, moveVertical);
rb.AddForce (movement * speed);
currentStamina -= Time.deltaTime * 70;
}
}
else
{
// the player does not request to move, so we restore the stamina.
moveHorizontal = 0.0f;
moveVertical = 0.0f;
}
}
void Update () {
Debug.Log (currentStamina);
}
}
/* public class PhysicsBall : MonoBehaviour {
public float speed;
private Rigidbody rb;
void Start ()
{
rb = GetComponent<Rigidbody> ();
}
// Update is called once per frame
void FixedUpdate () {
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0, moveVertical);
rb.AddForce (movement * speed);
}
}
*/
EDIT: I discovered something weird in the project but it's a different question so I made a new question: Both are scale 1, one is a lot smaller
But it's very likely to relate to this problem as the larger ball works fine.
