|
6 | 6 | Generally 2D and 3D physics interpolation work in very similar ways. However, there |
7 | 7 | are a few differences, which will be described here. |
8 | 8 |
|
9 | | -Global versus local interpolation |
10 | | ---------------------------------- |
11 | | - |
12 | | -- In 3D, physics interpolation is performed *independently* on the **global |
13 | | - transform** of each 3D instance. |
14 | | -- In 2D by contrast, physics interpolation is performed on the **local transform** |
15 | | - of each 2D instance. |
16 | | - |
17 | | -This has some implications: |
18 | | - |
19 | | -- In 3D, it is easy to turn interpolation on and off at the level of each ``Node``, |
20 | | - via the :ref:`physics_interpolation_mode<class_Node_property_physics_interpolation_mode>` |
21 | | - property in the Inspector, which can be set to ``On``, ``Off``, or ``Inherited``. |
22 | | - |
23 | | -.. figure:: img/physics_interpolation_mode.webp |
24 | | - :align: center |
25 | | - |
26 | | -- However this means that in 3D, pivots that occur in the ``SceneTree`` (due to |
27 | | - parent child relationships) can only be interpolated **approximately** over the |
28 | | - physics tick. In most cases this will not matter, but in some situations the |
29 | | - interpolation can look slightly wrong. |
30 | | -- In 2D, interpolated local transforms are passed down to children during |
31 | | - rendering. This means that if a parent has ``physics_interpolation_mode`` set to |
32 | | - ``On``, but the child is set to ``Off``, the child will still be interpolated if |
33 | | - the parent is moving. *Only the child's local transform is uninterpolated.* |
34 | | - Controlling the on / off behavior of 2D nodes therefore requires a little more |
35 | | - thought and planning. |
36 | | -- On the positive side, pivot behavior in the scene tree is perfectly preserved |
37 | | - during interpolation in 2D, which gives super smooth behavior. |
38 | | - |
39 | | -Resetting physics interpolation |
40 | | -------------------------------- |
41 | | - |
42 | | -Whenever objects are moved to a completely new position, and interpolation is not |
43 | | -desired (so as to prevent a "streaking" artefact), it is the responsibility of the |
44 | | -user to call ``reset_physics_interpolation()``. |
45 | | - |
46 | | -The good news is that in 2D, this is automatically done for you when nodes first |
47 | | -enter the tree. This reduces boiler plate, and reduces the effort required to get |
48 | | -an existing project working. |
49 | | - |
50 | | -.. note:: If you move objects *after* adding to the scene tree, you will still need |
51 | | - to call ``reset_physics_interpolation()`` as with 3D. |
52 | | - |
53 | 9 | 2D Particles |
54 | 10 | ------------ |
55 | 11 |
|
|
0 commit comments