I don’t understand why is this happening. Can anyone explain it to me and please suggest how should I do a proper checking on velocity? Right after LaunchHero() code is called I need to check the velocity so that I can show some effect based on its velocity.
// after received input, it will call this function
private void LaunchHero()
{
isLaunched = true;
body.AddForce(new Vector3(0.0f, 5.0f, 0.0f), ForceMode.VelocityChange);
}
private void FixedUpdate()
{
if (isLaunched)
Debug.Log(body.velocity) // returns 0,0,0 right after LaunchHero() called, the next frame only start returning values
}
The other solution I found is instead of calling AddForce(), I can set body.velocity directly but I was told that I shouldn’t be modifying the velocity.