I’m trying to make my ball/Player spin around when I hit a enemy object.
Nothing happens when I hit it.
I am new to unity so I don’t very much.
function OnCollisionEnter (collision : Collision)
{
if(gameObject.tag == “Enemy”)
{
transform.Rotate(Vector3(0, 3000, 0) * Time.deltaTime);
}
}
using the transform straight away is physics unfriendly because it will ignore all the colliders or gravity.
I’d sugest you to attach a rigidbody to the object, and add a torque force to it.(more info here)
So whenever you need An object to behave natural with the laws of physics, add a rigidbody To it. For more info about rigidbodys look here
Good luck !