mirror of
https://bitbucket.org/Ioncannon/project-meteor-server.git
synced 2025-04-25 14:17:46 +00:00
Move LookAt's same position check to the one that takes in an X and Y
position
This commit is contained in:
parent
9b566abb3d
commit
9889b6011b
1 changed files with 13 additions and 9 deletions
|
@ -652,7 +652,7 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
|
||||
public void LookAt(Actor actor)
|
||||
{
|
||||
if (actor != null && actor != this)
|
||||
if (actor != null)
|
||||
{
|
||||
LookAt(actor.positionX, actor.positionZ);
|
||||
}
|
||||
|
@ -672,16 +672,20 @@ namespace FFXIVClassic_Map_Server.Actors
|
|||
|
||||
public void LookAt(float x, float z)
|
||||
{
|
||||
var rot1 = this.rotation;
|
||||
//Don't rotate if the lookat position is same as our current position
|
||||
if (positionX != x || positionZ != z)
|
||||
{
|
||||
var rot1 = this.rotation;
|
||||
|
||||
var dX = this.positionX - x;
|
||||
var dY = this.positionZ - z;
|
||||
var rot2 = Math.Atan2(dY, dX);
|
||||
var dRot = Math.PI - rot2 + Math.PI / 2;
|
||||
var dX = this.positionX - x;
|
||||
var dY = this.positionZ - z;
|
||||
var rot2 = Math.Atan2(dY, dX);
|
||||
var dRot = Math.PI - rot2 + Math.PI / 2;
|
||||
|
||||
// pending move, dont need to unset it
|
||||
this.updateFlags |= ActorUpdateFlags.Position;
|
||||
rotation = (float)dRot;
|
||||
// pending move, dont need to unset it
|
||||
this.updateFlags |= ActorUpdateFlags.Position;
|
||||
rotation = (float)dRot;
|
||||
}
|
||||
}
|
||||
|
||||
// todo: is this legit?
|
||||
|
|
Loading…
Add table
Reference in a new issue