100% found this document useful (1 vote)
166 views3 pages

The Reality of Virtual Environments: Jean-Christian Delannoy

The document discusses virtual environments and how realistic simulations of motion and interactions can be achieved through modeling objects based on classical mechanics and physics. It describes techniques for applying forces, detecting collisions between objects, and calculating post-collision velocities based on conservation of momentum and energy.

Uploaded by

Hany ElGezawy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
166 views3 pages

The Reality of Virtual Environments: Jean-Christian Delannoy

The document discusses virtual environments and how realistic simulations of motion and interactions can be achieved through modeling objects based on classical mechanics and physics. It describes techniques for applying forces, detecting collisions between objects, and calculating post-collision velocities based on conservation of momentum and energy.

Uploaded by

Hany ElGezawy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Virtual environmentsdo they really

live up to expectations and reality tests?


There has been an increased interest in
virtual reality applications thanks to the
amazing advances in graphics technology and computing power. Highly
detailed three-dimensional (3-D) com-

The Reality
of Virtual
Environments
Jean-Christian Delannoy
puter models and environments are commonly used in
design, manufacturing, simulation, and entertainment.
These virtual environments (VEs) are often
successful at appearing
realistic when time
remains still, but as the
mobile objects are set into
motion and interact with
their surroundings, the movements often appear unnatural.
In many prerendered VEs
used for entertainment purposes, all of the objects
motions must be handmade
by 3-D animators in a process
that is time consuming and
lacks strict realism. In other
VEs such as the first generation of 3-D video games,
objects are modeled by their
bounding space or by a
sphere that surrounds all of
the 3-D models vertices. In
these cases, the motions are often quite
linear, and the collision response algorithms are quite simplistic; some even
revert to stopping an objects motion
when it collides with the environment.
These techniques are much too minimal and greatly reduce the level of
realism in VEs.
Letting animations follow their own
physics is quickly becoming the new
recipe for realism as new techniques for
modeling and animation based on the
laws of classical mechanics are emerging in all virtual reality applications.

Forces and friction


In a VE, just as in the real world,
forces affect bodies in accordance with
the second law of Newton. The sum of

AUGUST/SEPTEMBER 2005

all forces through the center of mass of a


body equals the mass multiplied by the
linear acceleration, and the sum of all
torques applied to the object equals the
product of the moment of inertia and the
angular acceleration. Both the linear and
angular velocities will be modified whenever a force is applied on a line that does
not intersect the center of mass since
torque will be generated. The object will
not only start moving away but it will
also start turning on a certain axis. Forces
applied to an object are first decomposed
into the component that is applied directly through the center of mass and the
remainder that causes torque. Com-

DIGITAL STOCK CORP.

ponents through the center of mass modify the linear velocity whereas the
remainders will modify the angular
velocity of the object in question.
These principles can be programmatically applied to the virtual world efficiently. During every program loop, whenever
a force is applied to an object it is decomposed into the component that modifies
the linear velocity and the component that
modifies the angular velocity; these forces
are added to two resulting vectors representing the sum of all the linear forces
and the sum of all angular forces on the
object. At the end of each program loop
when all of the forces have been added to
all of the objects in the VE, the total linear
and angular forces are used to obtain the
linear and angular accelerations of the

0278-6648/05/$20.00 2005 IEEE

object in question with Newtons laws.


These results are used with the elapsed
time since the last loop to obtain the
updated velocities. The elapsed time must
be used in this process otherwise the simulation would be frame-rate dependent,
i.e., the simulation would run faster on a
stronger computer capable of executing
the program loop more times per second.
Figure 1 shows pseudocode of how forces
are handled in a typical program loop.
This technique is excellent for realistically simulating all kinds of forces,
such as natural and noninteractive
forces like gravity. This technique is
also excellent for managing interactive
forces that are controlled
by a user or artificial intelligence to get an object
from A to B. Realistic
motion will be the result
of thruster forces that are
applied to various predetermined points on the
model with specific magnitudes and orientations.
The motion is usually also
affected by friction coefficients on the object that
are proportional to the
speed of the entity. A user
can control the model by
various keys, which will
enable specific thrusters
when pressed.
In most situations
there will be a main
thruster that has a large
magnitude and is always
pointing towards the front
of the model through the
center of mass. This force
is used to make the
model advance without
changing the current orientation. There
are other forces that have no component through the center of mass; this
means that enabling any of these
thrusters wont be directly responsible
for any shift in the position of the
model but will only modify the orientation of the object. Usually there are six
thrusters to allow rotation around any
of the axes in the clockwise and counterclockwise directions (Fig. 2). By
combining these forces, the user can
rotate the ship around any one of its
three relative axes (right, top, front) and
gains a fully 3-D range of motions.

Collision detection and response


Two main equations are used to determine post-collision velocities of any

37

number of colliding bodies: the


law of conservation of momentum (1) and the law of conservation of energy (2). The conservation of momentum law states
that the sum of the momenta of
the colliding bodies before the
collision will be equal to the
sum after the collision. The linear momentum of a body is
obtained by multiplying its mass
with its velocity. The rotational
analogue to linear momentum is
the angular momentum, defined
as the product of the moment of
inertia and the angular velocity;
it is subject to the same conservation of momentum principle

Object.TotalForce = (0,0,0);
Object.TotalTorque = (0,0,0);

center. Collisions occur whenever the distance between the center of two objects is less than or
equal to the sum of the radii of
the two objects. The collision
normal is the normalized vector
going from the center of one
object to the other.

Object.ApplyForces();

TotalForce += Force * R;
TotalTorque += Force R;

Object.Acceleration = Object.TotalForce / Object.Mass;


Object.AngularAcceleration = Object.TotalTorque / Object.Inertia;

OBB collision detection

If a collision has been


detected using the method with
spheres, we can proceed to our
second level of collision detecObject.Position += Object.Velocity * TimeElapsed;
tion, which is more computaObject.Orientation += Object.AngularVelocity * TimeElapsed;
tionally expensive but also
much more accurate. In this
Fig. 1 Pseudocode for force application and decomposition
method the volume of each
object isnt a sphere but a set of

+
+
OBBs, 3-D boxes that rotate
m1 v1 + m2 v2 = m1 v1 + m2 v2 s. (1)
when the model rotates. Detecting a colbe one; in a perfectly inelastic collision, it
lision with these shapes is more involved
will be zero since all energy will be lost.
The elasticity of collision law accounts
than it was with spheres. Here is the
Before any processing can be done to
for the amount of energy lost during the
sequence of events when verifying for
handle a collision, the collision itself must
collision. This elasticity is necessary since
collisions of object A against object B:
be detected. This is dealt with in a hierarimpacts in reality will create deformations
For every set of four neighboring
chical manner: collision detection using
on the colliding objects, whereas in our
coplanar vertices of the OBB of object
spheres and, if the result of the sphere test
simulation the objects are rigid and dont
A, set up a plane equation (Ax + B y+
was positive, collision detection using orichange shape at all. The simulation relies
C z + D = 0) with the normal heading
ented bounding boxes (OBBs), a set of
on an empirical relation to quantify the
outward.
polygons that encapsulate the 3-D model
energy lost during the impact. Its com For every edge of object B, check if
more accurately than the sphere. The OBB
puted by dividing the difference between
the line intersects with any of As planes.
will move and rotate along with the 3-D
the velocities of both objects after the col If an intersection point is found, see
model it represents in the collision world.
lision by the difference in velocity of both
if the intersection point is on the polygon
The collision response can also be
objects before the collision. The coeffiand not just on the plane. (A plane
thought of as consisting of two parts: the
cient of restitution is a value between 0
ranges from negative to positive infinity,
linear collision response, dealing with
and 1 and represents the amount of enerand a polygon is limited in its bounds.)
the linear velocities of objects, and the
gy lost during the collision
If the intersection point is on the
angular
collision
response,
dealing
with
(v 1+ v2+ )
polygon, there is a collision.
the angular velocities of the objects.
e=
.
(2)
(v 1 v2 )
The collision normal is the normal
When dealing with linear collision
of the traversed plane.
response, the collision detection algoThe collision detection routine consists
rithm will only need to supply the normal
No energy is lost in a perfectly elastic
of two hierarchical levels. Collision detecof the collision plane upon detecting a
collision, so the restitution coefficient will
tion with spheres is done first since it is
collision. During a collision, the two colquick and provides a good estimate; if a
liding objects wont undergo any modificollision is detected with the spheres, then
cation to their momentum that is orthogoTop
the second level of collision detection is
nal
to
the
collision
plane;
so
the
speed
Front
done with the OBBs method. The OBB
used in both the elasticity and momencollision detection involves much more
tum equations will be the speed of the
logic and calculations than the sphere colobject along the collision normal; the
lision test but is also much more precise.
component of the velocity that is orthogCreating a hierarchical collision detection
onal to the collision normal will not be
Right
routine provides the best of both worlds,
affected. When dealing with both linear
efficient and precise results, since the
and angular collision response, we will
heavier OBB collision detection routine is
need to know the normal of the collision
only called when two objects are near.
plane and also the point of collision.
Force Location and Orientation to Create
Object.Velocity += Acceleration * TimeElapsed;
Object.AngularVelocity += AngularAcceleration * TimeElapsed;

Angular Velocity around Right and Top.


Force Location and Orientation to Create
Angular Velocity around Right and Top.
Force Location and Orientation to
Create Angular Velocity around Front.
Fig. 2 Thruster topology on a 3-D rigid
body

38

Spherical collision detection

Collision response

In this first implementation, the volume of every object is represented by a


sphere with a radius equal to the maximum distance between any of the vertices of the 3-D model and the models

Collision response determines the


postcollision velocities of objects that
have just been involved in a collision.
With linear collision response, the
angular velocities of the colliding

IEEE POTENTIALS

objects is not taken into account or


modified. Linear and angular collision
response bears its name because it
takes into account and modifies not
only the linear velocity of objects but
also their angular velocity; e.g., a baseball bat floating in outer space that is
hit at one of its extremities will not
only start moving away but will also
gain angular velocity and start spinning
on its center of mass.

Linear collision response


The impulse method is used to determine the postcollision velocities of two
objects involved in a collision. Much like
a real impulse, the method quantifies an
indefinitely large force acting for a very
short time (a collision) and produces a
finite change of momentum. In contrast,
some simulations make use of penalty
methods to compute the collision
response. With penalty methods, objects
are allowed to become embedded in
one another. When the bodies are
embedded, they both become affected
by repulsion forces that are proportional
to the level of interpenetration between
the bodies. These repulsion forces cause
both bodies to move apart and resolve
the collision. The impulse method is
based on the equations of conservation
of momentum and elasticity. It consists
of calculating a simple scalar as a function of the velocity and mass of both
objects and then using this scalar to
modify the velocities of both entities.
The impulse scalar is calculated as
J=

(v 1 n + v2 n)(e + 1)




,
1
1
m1 + m2

are the same as they were for the linear


collision (conservation of momentum,
energy) except that the angular velocity,
the moment of inertia, and the distance
from the point of collision to the center of
mass will also affect the momentum of
the objects. This algorithm uses the
momentum of the object computed with
the velocity at the specific point of contact, which is dependent on the angular
velocity as well as the relative positioning
of the point of contact. The moment of a
rotating body is defined as
mv total = mv linear + I (
 r),

where I is the moment of inertia, is the


angular velocity, and r is the vector from
center of mass to collision point.
The impulse method is used once
again to bring the number of arithmetic
operations to a minimum. The equations of conservation of momentum and
elasticity, used in conjunction with the
complete momentum formula, create
the complete version of the impulse
method as shown in
J=
1
m1

(v 1 n + v2 n)(e + 1)



 .
1
+ m2 + (r 1 In1)r 1 + (r 2 In2)r 2 n
(6)

The impulse ( J ) will be used to


modify the linear and angular velocities
of the objects in our virtual environ-

(3)

where e is the restitution coefficient, n


is the collision normal, m is the object
mass, and v is the object velocity.
The postcollision velocities of both
objects are then modified using this scalar
v1 = v1 +

J n
m1

v2 = v2 +

J n
.
m2

Normal

Fig. 4 Sphere collision plane

ment. Once again, the impulse will be


added to the first object but subtracted
from the second object (7), (8) since
both bodies receive opposing forces
J n
m1
J n
v2 = v2 +
m2
J (r 1 n)
1 +

1 =
I1
J (r 2 n)

2 =
2
.
I2
v1 = v1 +

(7)

(8)

Applicability
Virtual reality applications used in
domains such as medicine and entertainment benefit greatly from more accurate
representations of real-world phenomena;
e.g., the aerospace industry can build
entire aircraft without requiring a physical
prototype. Instead, a virtual model is built
and undergoes tests in physically driven
VEs at a fraction of the cost of building a
prototype. By using characteristic equations from the environment, the reactions
of the objects are not only much more
believable but custom programming is
not needed for any single case.

D. Bourg, Physics for Game


Developers. OReilly, Farnham, 2002.
Delannoy, Petriu, and Wide,
Mechanics modeling for virtual interactive
environments, in Proc. HAVE 2003, 2003,
pp. 5559.
K. Kaiser, 3D Collision Detection,
Game Programming Gems. Rockland:
Charles River Media, 2000, pp. 390402.
N. Bobic, Advanced Collision
Detection Techniuqes, [Online]. Available:
http://www.gamastura.com/features/20000330/bocic_01.html

Note that for the second object, the


impulse is subtracted instead of being
added to the velocity. This confirms that
equal but opposing forces are applied
to the objects during the collision.

Linear and angular


collision response

AUGUST/SEPTEMBER 2005

Collision

Read more about it

(4)

Linear and angular collision response


will modify the linear and angular velocities of the VE objects. Characteristic equations for this type of collision response

(5)

Collision Plane

About the author


Fig. 3 Three-dimensional model with
oriented bounding box (OBB)

Jean-Christian Delannoy is a graduate student in electrical engineering at


the University of Ottawa, Canada.

39

You might also like