Hi i have a script that throws object below. For example in 10FPS it throws with a lot of power but in like 200FPS it throws with normal power. I multiple some values with time*deltatime to fix that but its not working what is the problem can you help me
void Update()
{
ThrowPress();
}
private void ThrowPress()
{
if (CurrentObject == null)
{
return;
}
if (Input.GetKey(KeyCode.G))
{
if (currentThrowForce <= maxThrowForce)
{
currentThrowForce += ThrowIncreaseSpeed * Time.deltaTime;
if (currentThrowForce >= maxThrowForce/8)
{
ThrowBar.gameObject.SetActive(true);
}
ThrowBar.value = currentThrowForce;
}
}
if (currentThrowForce > maxThrowForce)
{
currentThrowForce = maxThrowForce;
}
if (Input.GetKeyUp(KeyCode.G))
{
ThrowAction();
}
}
public void ThrowAction()
{
CurrentObject.velocity = CurrentObject.transform.forward*currentThrowForce*Time.deltaTime;
CurrentObject.useGravity = true;
CurrentObject.transform.parent = pickUpObjectHolder;
CurrentObject.transform.rotation = CurrentObject.transform.rotation;
foreach (Collider collider in CurrentObject.GetComponents<Collider>())
{
collider.enabled = true;
}
foreach (Collider collider in CurrentObject.GetComponentsInChildren<Collider>())
{
collider.enabled = true;
}
CurrentObject.isKinematic = false;
CurrentObject = null;
currentThrowForce = 0;
ThrowBar.value = 0;
ThrowBar.gameObject.SetActive(false);
isObjectInHands = false;
if (gunSC != null)
{
gunSC.enabled = false;
}
if (foodSC != null)
{
foodSC.enabled = false;
}
return;
}