Renames / fixes for Godot 4

This commit is contained in:
Max Hilbrunner
2022-10-16 20:36:12 +02:00
parent e12fcc3da4
commit 99d3d0be12
25 changed files with 72 additions and 85 deletions

View File

@@ -250,7 +250,7 @@ Traversal
The last common use case for the curves is to traverse them. Because of what was mentioned before regarding constant speed, this is also difficult.
To make this easier, the curves need to be *baked* into equidistant points. This way, they can be approximated with regular interpolation (which can be improved further with a cubic option). To do this, just use the :ref:`Curve.interpolate_baked()<class_Curve_method_interpolate_baked>` method together with
To make this easier, the curves need to be *baked* into equidistant points. This way, they can be approximated with regular interpolation (which can be improved further with a cubic option). To do this, just use the :ref:`Curve3D.sample_baked()<class_Curve3D_method_sample_baked>` method together with
:ref:`Curve2D.get_baked_length()<class_Curve2D_method_get_baked_length>`. The first call to either of them will bake the curve internally.
Traversal at constant speed, then, can be done with the following pseudo-code:

View File

@@ -68,7 +68,7 @@ Transform interpolation
-----------------------
It is also possible to interpolate whole transforms (make sure they have either uniform scale or, at least, the same non-uniform scale).
For this, the function :ref:`Transform.interpolate_with() <class_Transform_method_interpolate_with>` can be used.
For this, the function :ref:`Transform3D.interpolate_with() <class_Transform3D_method_interpolate_with>` can be used.
Here is an example of transforming a monkey from Position1 to Position2:

View File

@@ -38,7 +38,7 @@ The randomize() method
----------------------
In global scope, you can find a :ref:`randomize()
<class_@GDScript_method_randomize>` method. **This method should be called only
<class_@GlobalScope_method_randomize>` method. **This method should be called only
once when your project starts to initialize the random seed.** Calling it
multiple times is unnecessary and may impact performance negatively.
@@ -58,7 +58,7 @@ Putting it in your main scene script's ``_ready()`` method is a good choice:
}
You can also set a fixed random seed instead using :ref:`seed()
<class_@GDScript_method_seed>`. Doing so will give you *deterministic* results
<class_@GlobalScope_method_seed>`. Doing so will give you *deterministic* results
across runs:
.. tabs::
@@ -97,7 +97,7 @@ Getting a random number
Let's look at some of the most commonly used functions and methods to generate
random numbers in Godot.
The function :ref:`randi() <class_@GDScript_method_randi>` returns a random
The function :ref:`randi() <class_@GlobalScope_method_randi>` returns a random
number between 0 and 2^32-1. Since the maximum value is huge, you most likely
want to use the modulo operator (``%``) to bound the result between 0 and the
denominator:
@@ -119,7 +119,7 @@ denominator:
// Prints a random integer between 10 and 60.
GD.Print(GD.Randi() % 51 + 10);
:ref:`randf() <class_@GDScript_method_randf>` returns a random floating-point
:ref:`randf() <class_@GlobalScope_method_randf>` returns a random floating-point
number between 0 and 1. This is useful to implement a
:ref:`doc_random_number_generation_weighted_random_probability` system, among
other things.
@@ -145,7 +145,7 @@ varying by the deviation (1.0 by default):
random.Randomize();
GD.Print(random.Randfn());
:ref:`rand_range() <class_@GDScript_method_rand_range>` takes two arguments
:ref:`randf_range() <class_@GlobalScope_method_randf_range>` takes two arguments
``from`` and ``to``, and returns a random floating-point number between ``from``
and ``to``:
@@ -153,12 +153,7 @@ and ``to``:
.. code-tab:: gdscript GDScript
# Prints a random floating-point number between -4 and 6.5.
print(rand_range(-4, 6.5))
.. code-tab:: csharp
// Prints a random floating-point number between -4 and 6.5.
GD.Print(GD.RandRange(-4, 6.5));
print(randf_range(-4, 6.5))
:ref:`RandomNumberGenerator.randi_range()
<class_RandomNumberGenerator_method_randi_range>` takes two arguments ``from``
@@ -174,7 +169,7 @@ and ``to``, and returns a random integer between ``from`` and ``to``:
.. code-tab:: csharp
# Prints a random integer number between -10 and 10.
// Prints a random integer number between -10 and 10.
random.Randomize();
GD.Print(random.RandiRange(-10, 10));
@@ -328,7 +323,7 @@ We can apply similar logic from arrays to dictionaries as well:
Weighted random probability
---------------------------
The :ref:`randf() <class_@GDScript_method_randf>` method returns a
The :ref:`randf() <class_@GlobalScope_method_randf>` method returns a
floating-point number between 0.0 and 1.0. We can use this to create a
"weighted" probability where different outcomes have different likelihoods: