In my game, the player is a first person controller. The player can also place soccer balls on the ground. I want it so then when the first person controller collides with the soccer balls, they will start to roll around. Is there any way I can do this?
The CharacterController is just constrained by other colliders - it doesn’t push anything. If you want to push rigidbodies, use OnControllerColliderHit to detect the collision and to apply a force or set the rigidbody velocity:
var force: float = 100;
function OnControllerColliderHit(hit: ControllerColliderHit){
if (hit.rigidbody){
var dir = hit.normal; // get the hit direction
dir.y = 0; // consider only the horizontal direction
hit.rigidbody.AddForce(force * dir.normalized);
}
}
Tweak the force in order to get better results. You may also set dir.y to a value between 0.1 and 0.5 to make the ball go a little up instead of strictly horizontal.
Sphere collider and rigidbody, you most likely want gravity activated.
You might want to watch some tutorials or reading up on how unity works.