Fix code block formatting and reference in Physics introduction

This commit is contained in:
Hugo Locurcio
2020-08-03 13:54:08 +02:00
parent c40d74e19b
commit f3e24e46b7
2 changed files with 11 additions and 6 deletions

View File

@@ -537,7 +537,10 @@ the :ref:`RigidBody <class_RigidBody>` we collided with to ``MODE_STATIC`` so it
Finally, we set the grabbed :ref:`RigidBody <class_RigidBody>`'s collision layer and collision mask to ``0``.
This will make the grabbed :ref:`RigidBody <class_RigidBody>` have no collision layer or mask, which means it will not be able to collide with anything as long as we are holding it.
.. note:: See :ref:`doc_physics_introduction_collision_layer_code_example` for more information on Godot collision masks.
.. note::
See :ref:`Physics introduction <doc_physics_introduction_collision_layer_code_example>`
for more information on Godot collision masks.
______

View File

@@ -125,7 +125,8 @@ be assigned in Project Settings -> Layer Names.
.. image:: img/physics_layer_names.png
**GUI example:**
GUI example
^^^^^^^^^^^
You have four node types in your game: Walls, Player, Enemy, and Coin. Both
Player and Enemy should collide with Walls. The Player node should detect
@@ -140,7 +141,10 @@ interact with. For example, the Player's settings would look like this:
.. image:: img/player_collision_layers.png
.. image:: img/player_collision_mask.png
**Code example:**
.. _doc_physics_introduction_collision_layer_code_example:
Code example
^^^^^^^^^^^^
In function calls, layers are specified as a bitmask. Where a function enables
all layers by default, the layer mask will be given as ``0x7fffffff``. Your code
@@ -148,9 +152,7 @@ can use binary, hexadecimal, or decimal notation for layer masks, depending
on your preference.
The code equivalent of the above example where layers 1, 3 and 4 were enabled
would be as follows:
.. _doc_physics_introduction_collision_layer_code_example:
would be as follows::
# Example: Setting mask value for enabling layers 1, 3 and 4