mirror of
https://github.com/godotengine/godot-docs.git
synced 2026-01-05 22:09:56 +03:00
pi/4 is 45 degrees.
This commit is contained in:
@@ -272,7 +272,7 @@ Here is the complete ``Mob.gd`` script for reference.
|
||||
# We position the mob by placing it at start_position
|
||||
# and rotate it towards player_position, so it looks at the player.
|
||||
look_at_from_position(start_position, player_position, Vector3.UP)
|
||||
# Rotate this mob randomly within range of -90 and +90 degrees,
|
||||
# Rotate this mob randomly within range of -45 and +45 degrees,
|
||||
# so that it doesn't move directly towards the player.
|
||||
rotate_y(randf_range(-PI / 4, PI / 4))
|
||||
|
||||
@@ -311,7 +311,7 @@ Here is the complete ``Mob.gd`` script for reference.
|
||||
// We position the mob by placing it at startPosition
|
||||
// and rotate it towards playerPosition, so it looks at the player.
|
||||
LookAtFromPosition(startPosition, playerPosition, Vector3.Up);
|
||||
// Rotate this mob randomly within range of -90 and +90 degrees,
|
||||
// Rotate this mob randomly within range of -45 and +45 degrees,
|
||||
// so that it doesn't move directly towards the player.
|
||||
RotateY((float)GD.RandRange(-Mathf.Pi / 4.0, Mathf.Pi / 4.0));
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ Next is ``Mob.gd``.
|
||||
# We position the mob by placing it at start_position
|
||||
# and rotate it towards player_position, so it looks at the player.
|
||||
look_at_from_position(start_position, player_position, Vector3.UP)
|
||||
# Rotate this mob randomly within range of -90 and +90 degrees,
|
||||
# Rotate this mob randomly within range of -45 and +45 degrees,
|
||||
# so that it doesn't move directly towards the player.
|
||||
rotate_y(randf_range(-PI / 4, PI / 4))
|
||||
|
||||
@@ -283,7 +283,7 @@ Next is ``Mob.gd``.
|
||||
// We position the mob by placing it at startPosition
|
||||
// and rotate it towards playerPosition, so it looks at the player.
|
||||
LookAtFromPosition(startPosition, playerPosition, Vector3.Up);
|
||||
// Rotate this mob randomly within range of -90 and +90 degrees,
|
||||
// Rotate this mob randomly within range of -45 and +45 degrees,
|
||||
// so that it doesn't move directly towards the player.
|
||||
RotateY((float)GD.RandRange(-Mathf.Pi / 4.0, Mathf.Pi / 4.0));
|
||||
|
||||
|
||||
@@ -537,7 +537,7 @@ And the *Mob*'s script.
|
||||
# We position the mob by placing it at start_position
|
||||
# and rotate it towards player_position, so it looks at the player.
|
||||
look_at_from_position(start_position, player_position, Vector3.UP)
|
||||
# Rotate this mob randomly within range of -90 and +90 degrees,
|
||||
# Rotate this mob randomly within range of -45 and +45 degrees,
|
||||
# so that it doesn't move directly towards the player.
|
||||
rotate_y(randf_range(-PI / 4, PI / 4))
|
||||
|
||||
@@ -586,7 +586,7 @@ And the *Mob*'s script.
|
||||
// We position the mob by placing it at startPosition
|
||||
// and rotate it towards playerPosition, so it looks at the player.
|
||||
LookAtFromPosition(startPosition, playerPosition, Vector3.Up);
|
||||
// Rotate this mob randomly within range of -90 and +90 degrees,
|
||||
// Rotate this mob randomly within range of -45 and +45 degrees,
|
||||
// so that it doesn't move directly towards the player.
|
||||
RotateY((float)GD.RandRange(-Mathf.Pi / 4.0, Mathf.Pi / 4.0));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user