Hi,
Im checking ground so i can add a force down when isnt on ground. The problem is that my GameObjects flickers when on ground.
I desactivate the “use gravity” in the rigidbody, but it stills flickering.
This is the code i have for that force down.
void FixedUpdate()
{
if (!isGround)
{
rb.AddForce(Vector3.up * -gravityForceMultiplier * 50);
}
else
{
rb.AddForce(Vector3.up * -normalGravity);
}
}
And this is the code for raycasting.
private void Update()
{
if (Physics.Raycast(this.transform.position, Vector3.down, disToGround, groundLayer))
{
isGround = true;
}
else
{
isGround = false;
}
}
Thanks and sorry for my bad English.