Game Development Reference
In-Depth Information
var ray:Ray =
var sphere : GameObject =
sphere.transform.position = ray.origin;
sphere.AddComponent ("Rigidbody");
sphere.rigidbody.mass = 10;
sphere.rigidbody.AddForce(ray.direction * 1000);
Step 5. Because the sphere has more mass, the added force has less
effect. However, you may be able to get it to roll along the ground.
The extra mass will be enough to knock over the cubes.
Step 6. Try setting the AddForce() multiplier to 10,000. Note that
because the mass has increased 10-fold, the force required to move
the sphere in the same way must also increase 10-fold.
2.5.4 The Third Law of Motion
To every action there is always opposed an equal reaction; or, the
mutual actions of two bodies upon each other are always equal,
and directed to contrary parts.
This can be rephrased to the well-known adage for every action there is
an equal and opposite reaction . When a truck hits a car, energy from the
movement of the truck is transferred to the car and it is propelled away
from the truck. If a car hits another car of a similar size, some of the energy
is transferred to the second car, while some goes back into the first car. If a
car hits a brick wall, chances are most of the energy will go back into the car.
This energy needs to go somewhere. In the case of cars, specially designed
crumple zones absorb the energy. For a tennis ball, some of the energy is
absorbed by the rubbery nature of the ball and the rest is used to propel
the ball away. In other words, collisions occurring in the real world have
an effect on the environment as well as the object.
The examples thus far examined in Unity see energy from an initial force
transferred or totally absorbed by the objects. For a heavy sphere, cubes are
knocked over easily, whereas a light sphere hits the cubes and drops straight
to the ground. This rarely happens in the real world where things tend to
bounce , to some degree. In Unity, adding a physics material to an object
can simulate these extra effects.
Search Nedrilad ::

Custom Search