Skip to content

Conversation

@Calinou
Copy link
Member

@Calinou Calinou commented Feb 10, 2025

The mob's orientation was previously shifted according to the player's height, which could lead to collision and movement issues that were difficult to diagnose.

The mob's orientation was previously shifted according to the player's
height, which could lead to collision and movement issues that were
difficult to diagnose.
@Calinou Calinou force-pushed the squash-the-creeps-fix-look-at-from-position branch from 89ba3f6 to f08df2b Compare February 10, 2025 12:10
@gabriele2000
Copy link

gabriele2000 commented Mar 2, 2025

In my modest opinion, as a user and someone with a very small (for now) background on programming, I'd like to propose a change.

The following changed code

func initialize(start_position, player_position):
	# Ignore the player's height, so that the mob's orientation is not slightly
	# shifted if the mob spawns while the player is jumping.
	var target = Vector3(player_position.x, start_position.y, player_position.z)
	look_at_from_position(start_position, target, Vector3.UP)

could be just

func initialize(start_position, player_position):
	# Ignore the player's height, so that the mob's orientation is not slightly
	# shifted if the mob spawns while the player is jumping.
        # start_position.y could also be written as 0.0
	player_position = Vector3(player_position.x, start_position.y, player_position.z)
	look_at_from_position(start_position, player_position, Vector3.UP)

player_position has been already declared inside func, now we just need to overwrite the player_position.y value then process the overwrited value.
No need to declare a variable, let alone a new one, just for a small correction.

@aaronfranke
Copy link
Member

Needs a rebase.

@gabriele2000 Modifying function parameters is considered a bad practice by some, so I wouldn't encourage it in official demos, even though it would work fine either way and potentially use ever-so-slightly less memory.

Copy link
Member

@aaronfranke aaronfranke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I resolved the conflicts, this is good to go!

@aaronfranke aaronfranke merged commit 57daa67 into godotengine:master Oct 2, 2025
1 check passed
@Calinou Calinou deleted the squash-the-creeps-fix-look-at-from-position branch October 2, 2025 15:01
@aaronfranke aaronfranke added this to the 4.5 milestone Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants