Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added PlayerMixin.snap_to_position(origin=None, angles=None).
- Loading branch information
1 parent
1604995
commit ff7819a
Showing
3 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ff7819a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this the same like teleport?
ff7819a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Entity.teleport
, in addition of being a dynamic function that is slightly slower to call, does everything right away (notify move hierarchy, triggers and collidables detection, targets scanning (for bots), physics, etc, etc.) while this only snap the location and angles of the player. If you don't care about whether this is all done on this very frame, or that you know you are before the engine does everything either way (e.g. into apre_think
hook,OnPlayerRunCommand
callback, or at any point before the movements are actually processed on the current frame, then you will benefit from usingPlayer.snap_to_position
. For example:The behaviours are essentially the same as doing:
But that is considerably slower than a direct call:
7.805805683135986
(with v708 this time at305.80093216896057
...). Though, we could certainly improve these attributes.