Hey guys
Just working on my little sporting game simulation, I wanted to have all the players on one side of the net move to a specific position on the court after the collision between the ball and the player. This is the script I have now on the player to which the ball is colliding
function OnCollisionEnter(collision : Collision) {
if( collision.gameObject.tag == "ball" )
{
collision.gameObject.rigidbody.angularVelocity = Vector3.zero;
collision.gameObject.rigidbody.velocity = Vector3(-5,20,-5);
}
}
Just a few questions
:arrow: What would be the code I would use? (I think it is the translate/transform piece of code but still a little unsure of how to use it correctly) and where would it be placed on the script?
:arrow: Would I place it along with the collision code (as it is the collision which triggers the movement) or in an entirely different script?
At the moment this is the main problem I am getting into, the plan is to have a random number generated and different actions based on the different numbers generated but at the moment that is a long way away ![]()