1
\$\begingroup\$

Pretty simple question and I didn't find any place that explains it in the context of game development, wiki explains offset in the context of geometry (parallel curves) and I am pretty sure its not the same offset in game development. I use Unity, and I encounter this term a lot.

Please explain it to me, thank you in advance.

\$\endgroup\$
6
\$\begingroup\$

It is, in fact, basically the same concept. An offset is just a displacement, a difference between two things. Most of the time it's used by adding it to some original value to obtain a new value.

It's used in a lot of different contexts in game development, which is perhaps what may be confusing you. You could have a 2D vector that is an offset representing how far an object moves when struck with an attack. You could have a scalar value called an "offset" that represents how many degrees to sway the camera in a FPS while the player is experiencing a "drunken" effect. There are innumerable ways to use the concept, but it's basically the same thing.

\$\endgroup\$
  • \$\begingroup\$ So what is the difference between offset and displacement? It is just that offset usually starts from the origin and displacement doesn't? \$\endgroup\$ – LiziPizi Mar 11 '17 at 20:55
  • \$\begingroup\$ There's no hard rule for when to call something an offset vs a displacement. It's mostly about emphasis. "Offset" suggests applying a shift or difference from some base value, "displacement" emphasises movement from one place to another. We could talk about the movement of an object over a single frame as either an offset or a displacement, for example. It's less conventional to call non-spatial offsets displacements (eg. Saying there's a "displacement" of 40 code points between upper & lowercase ASCII characters may sound a bit awkward) but you can do that too. \$\endgroup\$ – DMGregory Mar 11 '17 at 22:43
  • 1
    \$\begingroup\$ On the marine side, "displacement" describes how much water a ship hull displaces, ie. moves away in order to itself occupy that same volumne. Hence the displacement is also (almost) equal to the mass of the ship. Imho, the relevant difference between offset and displacement is that an offset happens in a certain, single direction and relative to the original situation, while displacement is a more general term for something that moves or changes. \$\endgroup\$ – Stormwind Mar 12 '17 at 0:31
  • \$\begingroup\$ AFAIK offset is always a scalar, single value or a single vector, but displacement maps are a thing (another kind of bump map varient, roughly) \$\endgroup\$ – StarWeaver Mar 12 '17 at 5:03
3
\$\begingroup\$

Offset means difference from the base/begin/origin. For example if my origin is Vector3(0,0,0) and you offset something with Vector3(1, 0, 0) the resulting position will be the origin + offset meaning Vector3 (1, 0, 0). Another example:

origin: Vector3 (15, 23, 19)
offset: Vector3 (8, 3, 1)
Resulting position: Vector3 (23, 26, 20)
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.