Hi I have a problem with two boomerang launch codes
public Animator animator;
public Rigidbody axeRB;
float thworPower = 10000;
private bool IsRetrning = false;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
if (Input.GetKeyDown(KeyCode.A))
{
animator.SetTrigger("Lanch");
}
}
public void AxThrow()
{
axeRB.isKinematic = false;
axeRB.transform.parent = null;
axeRB.AddForce(Camera.main.transform.TransformDirection(Vector3.forward) * thworPower);
axeRB.AddTorque(axeRB.transform.TransformDirection(Vector3.right) * 100, ForceMode.Impulse);
}
public void ReturnAxe()
{
IsRetrning = true;
axeRB.velocity = Vector3.zero;
axeRB.isKinematic = true;
}
public bool activated;
public float rotationSpeed;
public Scriptcharcter scriptcharcter;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
if (activated)
{
transform.localEulerAngles += Vector3.forward * rotationSpeed * Time.deltaTime;
}
}
private void OnCollisionEnter(Collision collision)
{
activated = false;
GetComponent<Rigidbody>().isKinematic = true;
scriptcharcter.ReturnAxe();
}
when I press “A” my boomerang is launched but it doesn’t rotate and doesn’t come back to my character it stays on the ground
if I check “activated” in the inspector it will rotate