Hi, i want to hit enemy and move the enemy up or right depending on animation and using same force speed,
but when i do that addforce up launches far in sky not like addforce right using same force speed.
float forceSpeed=100;
bool up=false; bool right=false;
// in update
if (Input.GetKeyDown(KeyCode.R)) up = true;
else if (Input.GetKeyDown(KeyCode.F)) right = true;
// in fixed update
if (up)
{
GetComponent().AddForce(Vector3.up * forceSpeed);
up = false;
}
else if (right)
{
GetComponent().AddForce(Vector3.right * forceSpeed);
right = false;
}
not same outcome, different magnitude.
mass=1, drag=0, angdrag=0.05,
use gravity=true,
not using physicsMaterial on gound.
↧