Hi, so I’m trying to make a bat weapon which essentially will spawn a trigger in front of the player. If another player is caught in the trigger they should go flying back-up and somewhere to the left. So I have this code
private void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag == "Player")
{
Vector3 vec = new Vector3(0,1,-1);
other.gameObject.GetComponent<Rigidbody>().AddForce(vec * launchSpeed);
Debug.Log($"Hit {other.gameObject}");
}
}
The log goes off, but he doesn’t move, the object getting hit has a rigidbody, is not kinematic and does not have any position constraints. I don’t know if I’m doing something wrong with the rigidbody or just something else with my wonky code.