Update references to private class methods across the docs

This commit is contained in:
Yuri Sizov
2023-11-10 12:58:44 +01:00
parent ca74950fac
commit cd92be066d
17 changed files with 60 additions and 60 deletions

View File

@@ -83,17 +83,17 @@ These nodes allow you to draw the shape directly in the editor workspace.
Physics process callback
~~~~~~~~~~~~~~~~~~~~~~~~
The physics engine runs at a fixed rate (a default of 60 iterations per second). This rate
The physics engine runs at a fixed rate (a default of 60 iterations per second). This rate
is typically different from the frame rate which fluctuates based on what is rendered and
available resources.
It is important that all physics related code runs at this fixed rate. Therefore Godot
It is important that all physics related code runs at this fixed rate. Therefore Godot
differentiates :ref:`between physics and idle processing <doc_idle_and_physics_processing>`.
Code that runs each frame is called idle processing and code that runs on each physics
tick is called physics processing. Godot provides two different callbacks, one for each
Code that runs each frame is called idle processing and code that runs on each physics
tick is called physics processing. Godot provides two different callbacks, one for each
of those processing rates.
The physics callback, :ref:`Node._physics_process() <class_Node_method__physics_process>`,
The physics callback, :ref:`Node._physics_process() <class_Node_private_method__physics_process>`,
is called before each physics step. Any code that needs to access a body's properties should
be run in here. This method will be passed a ``delta``
parameter, which is a floating-point number equal to the time passed in
@@ -249,7 +249,7 @@ automatically be calculated by the physics engine.
However, if you do wish to have some control over the body, you should take
care - altering the ``position``, ``linear_velocity``, or other physics properties
of a rigid body can result in unexpected behavior. If you need to alter any
of the physics-related properties, you should use the :ref:`_integrate_forces() <class_RigidBody2D_method__integrate_forces>`
of the physics-related properties, you should use the :ref:`_integrate_forces() <class_RigidBody2D_private_method__integrate_forces>`
callback instead of ``_physics_process()``. In this callback, you have access
to the body's :ref:`PhysicsDirectBodyState2D <class_PhysicsDirectBodyState2D>`,
which allows for safely changing properties and synchronizing them with

View File

@@ -40,7 +40,7 @@ Accessing space
Godot physics runs by default in the same thread as game logic, but may
be set to run on a separate thread to work more efficiently. Due to
this, the only time accessing space is safe is during the
:ref:`Node._physics_process() <class_Node_method__physics_process>`
:ref:`Node._physics_process() <class_Node_private_method__physics_process>`
callback. Accessing it from outside this function may result in an error
due to space being *locked*.
@@ -158,17 +158,17 @@ with Area3D, the boolean parameter ``collide_with_areas`` must be set to ``true`
.. code-tab:: gdscript GDScript
const RAY_LENGTH = 1000
func _physics_process(delta):
var space_state = get_world_3d().direct_space_state
var cam = $Camera3D
var mousepos = get_viewport().get_mouse_position()
var origin = cam.project_ray_origin(mousepos)
var end = origin + cam.project_ray_normal(mousepos) * RAY_LENGTH
var query = PhysicsRayQueryParameters3D.create(origin, end)
query.collide_with_areas = true
var result = space_state.intersect_ray(query)
Collision exceptions
@@ -182,7 +182,7 @@ as shown in the following image:
.. image:: img/raycast_falsepositive.webp
To avoid self-intersection, the ``intersect_ray()`` parameters object can take an
array of exceptions via its ``exclude`` property. This is an example of how to use it
array of exceptions via its ``exclude`` property. This is an example of how to use it
from a CharacterBody2D or any other collision object node:
.. tabs::
@@ -231,8 +231,8 @@ member variable. The array of exceptions can be supplied as the last argument as
func _physics_process(delta):
var space_state = get_world_2d().direct_space_state
var query = PhysicsRayQueryParameters2D.create(global_position, target_position,
collision_mask, [self])
var query = PhysicsRayQueryParameters2D.create(global_position, target_position,
collision_mask, [self])
var result = space_state.intersect_ray(query)
.. code-tab:: csharp