-1
I’m studying the game Flippy Knife, and I used Addrelativetorque to turn the knife and apply the 360 that always adds 1 point, but when trying to count the score checking if the knife has reached a certain angle, simply did not add any score (I tried several angles to see if it worked, but it didn’t work) The angle starts to zero, I made the counter run in the update, what I noticed was that in the inspector, when running the game, the rotation. x does not go from 0 to 360 for some reason, it works in a different way.
Torque code: (works as I drag the mouse)
void Launch()
{
isInAir = true;
knifeRb.isKinematic = false;
knifeRb.AddForce((releasePosition - touchPosition) * launchForce, ForceMode.Impulse);
knifeRb.AddRelativeTorque(torqueForce, ForceMode.Impulse);
}
Counter (put it in update to run):
void Contador()
{
if (contAng.transform.rotation.eulerAngles.x == 359)
{
pontos++;
}
}
I don’t understand... he’s just gonna add
pontos
if the angle is exactly 359?– Leandro Angelo