Hi,
In my 2D Marbler, I want to show the current velocity of the marble in the GUI.
This is what I have got for my guiText:
function Update () {
guiText.text = averageVelocity;
This is what I am using to find the velocity of the marble (copied from this post):
var averageVelocity : Vector3;
private var lastPosition : Vector3 = Vector3.zero;
function FixedUpdate () {
averageVelocity = (transform.position - lastPosition)/Time.fixedDeltaTime;
lastPosition = transform.position;
}
Note: The marble is a rigidbody.
I have spent a few hours now trying to figuire out what I have to do to fix it but I haven’t really gotten anywhere on my own. I am going to avoid asking for help on these types of basics in the future but I am completely stuck at the moment.