Int UK 3297 Folder Collection
After playing the video, you can click or select the word to look it up in the dictionary.
Loading...
Report Subtitle Errors
As a general rule, if you're going to have
moving game objects in your game
you should make sure that they are
rigidbody objects.
Rigidbodies are components that allow
a game object to be effected by physics.
They allow the object to fall under gravity,
and have physics properties such as mass,
drag and velocity.
When we add a rigidbody component
to a game object we often then refer to it
as a rigidbody object.
A rigidbody component is required for any physics
based interaction, and the game object
must also have a collider attached
in order to interact with other physics objects.
Without a rigidbody our power cube will
simply hover in mid air.
But let's see what happens when we add one.
Like any other component it can be added
using the Add Component button at
at the bottom of the inspector, or from
the 'Component' top menu.
You will find it under the Physics section.
Now our object falls under gravity
and can be controlled by the physics engine
and any forces that are applied to it.
Rigidbodies have numerous options.
Firstly there are settings to control the mass,
drag and angular drag of the game object.
The mass of the object effects how collisions
are treated with the object.
Game objects with a higher mass will react
less when collided with a lower mass
game object.
The drag of a game object effects how
quickly it will slow down without
other interactions.
Think of it like air resistance.
It's used to determine the rate of a loss
of linear velocity.
Similarly, angular drag effects how
quickly the game object will slow it's
angular velocity, i.e. how
fast it is rotating.
So for example if you're adding torque
to the object to rotate it,
the angular drag will create resistance
to this force. The next option is
whether or not the game object is
effected by gravity.
By enabling this checkbox we use gravity.
Settings for gravity can be seen in the
Edit - Project Settings - Physics area of Unity.
As you can see it's a 3 dimensional vector
which by default has a real world
value of -9.81.
Because you can customise it globally here
you could also create interesting effects
Such as low gravity for a platformer
or even setting it to a different axis
as part of a puzzle game.
For example, let's add gravity to the
Z axis by a value of 5.
And now the power cube is pulled towards
towards the global Z axis.
The Is Kinematic setting effects whether
or not a rigid body will react to physics.
Ordinarily when a scene begins, all static
geometry, meaning any non-rigidbody objects
are checked once by the physics engine
and not checked again for efficiency.
However when you move a static object
the physics engine must re-check all other
static objects for the sake of accuracy,
and this can be expensive to performance.
To avoid this, Kinematic rigidbody objects can be used
and moved via their transform
by using the Translate function.
This means that you can have physics objects
that effect others but are not effected themselves.
An obvious example of this would be the
paddle in a Pong or Breakout style game.
In this example our rigidbody power cube
has Use Gravity checked.
When we press play, the object falls to the ground.
We also have our round prop samoflange ball
object, which has a similar component setup.
If the power cube does not have gravity
then it will not fall under it, but it will
be effected by other objects.
If we don't want it to be effected by other
objects we can use Is Kinematic.
And as stated we can also move the object
via it's transform. So we'll make use of
this simple script, which uses the
translate function to move it via it's
forward direction every frame.
And as you can see, the object still
interacts with the others but remains a
rigidbody, so is constantly informing
the physics engine of it's location
and not forcing the physics engine
to re-evaluate the entire scene.
The Interpolate and Extrapolate settings
are there to solve jittering.
If you experience slight movement of your
object when moving it via it's rigidbody,
make use of the interpolate setting in order to
smooth the transform movement based on the
previous frame. And the extrapolate setting
to smooth based on a predicted
location in the next frame.
The next setting is for the type of
collision detection. We have Discrete,
Continuous and Continuous Dynamic.
The default is discrete and unless you
have any problems you should use discrete.
Continuous is for fast moving objects
that are interacting with static geometry.
And continuous dynamic is for fast moving
objects that are interacting with other
dynamic objects.
Finally the constraints section of the
rigidbody component allow you to
constrain movement or rotation of the object
by physics. For example, if you
had a Tetris style game you might not
want the cubes of your game to rotate
as they fell in to place. You could constrain
this using the rotation constraints here.
In this example our power cube is
falling on to the workbench. It's a rigid
body that has Use Gravity checked.
And as standard it falls like this.
If we didn't want it to rotate as it falls
we can freeze the rotation within the constraints.
And now when it falls, no rotation.
    You must  Log in  to get the function.
Tip: Click on the article or the word in the subtitle to get translation quickly!

Loading…

Physics Objects (Rigidbodies) - Unity Official Tutorials

3297 Folder Collection
朱瑛 published on May 2, 2014
More Recommended Videos
  1. 1. Search word

    Select word on the caption to look it up in the dictionary!

  2. 2. Repeat single sentence

    Repeat the same sentence to enhance listening ability

  3. 3. Shortcut

    Shortcut!

  4. 4. Close caption

    Close the English caption

  5. 5. Embed

    Embed the video to your blog

  6. 6. Unfold

    Hide right panel

  1. Listening Quiz

    Listening Quiz!

  1. Click to open your notebook

  1. UrbanDictionary 俚語字典整合查詢。一般字典查詢不到你滿意的解譯,不妨使用「俚語字典」,或許會讓你有滿意的答案喔