trigger_teleport: change teleported entity's angles while maintaining the same velocity.

This commit is contained in:
Marco Cawthorne 2023-04-16 11:53:03 -07:00
parent 89bf3e436a
commit 4a11c91d7d
Signed by: eukara
GPG Key ID: CE2032F0A2882A22
1 changed files with 8 additions and 0 deletions

View File

@ -69,7 +69,15 @@ trigger_teleport::Touch(entity eToucher)
if (eTarget) {
vector endpos = eTarget.origin + [0,0,16];
float flSpeed = vlen(eToucher.velocity);
makevectors(eToucher.angles);
eToucher.velocity = (v_forward * flSpeed);
eToucher.angles = eTarget.angles;
setorigin_safe(eToucher, endpos);
if (eToucher.flags & FL_CLIENT)
Client_FixAngle(eToucher, eToucher.angles);
NSLog("^2trigger_teleport::^3Touch^7: Teleported '%s' to `%v`",
eToucher.netname, endpos);
} else {