Home

worldToLocal

worldToLocal is a transformation operation that converts coordinates from world space into an object's local coordinate space. It is typically realized by applying the inverse of the object's world transform matrix. If a point in world space is P_world, the corresponding local coordinates are obtained as P_local = M_world^{-1} * P_world, where M_world is the 4x4 matrix representing the object's position, rotation, and scale in the world. For directions or vectors, you use a homogeneous coordinate with a zero w component to avoid translating the vector.

In practice, many graphics and game engines provide utilities to perform this operation directly, such as inverse

Common uses include hit testing and raycasting in local space, transforming points for physics calculations, animation

Overall, worldToLocal is a fundamental tool for interpreting world-position data within the context of an individual

transform
functions.
The
concept
is
the
reverse
of
localToWorld,
which
maps
local
coordinates
to
world
space.
The
worldToLocal
operation
requires
careful
handling
of
coordinate
conventions,
including
the
matrix
convention
(row-major
vs
column-major)
and
the
handedness
of
the
coordinate
system.
Non-uniform
scale
or
complex
rotations
can
affect
the
simplicity
of
the
results,
and
in
some
cases
additional
steps
may
be
needed
to
extract
pure
rotational
components.
skinning,
and
utility
scripts
that
need
to
interpret
world-origin
data
relative
to
an
object’s
local
frame.
In
many
engines,
equivalent
functions
exist,
such
as
Transform.InverseTransformPoint
in
Unity
or
similar
reverse
transforms
in
other
frameworks.
object’s
local
coordinate
system.