Psi

Psi

45M Downloads

[Minor] The Entity Position operator does not give exact position.

Mach12 opened this issue ยท 14 comments

commented

At least for player entities, it gives head position instead.

While this does facilitate raycasting, the position of a player is at its feet, and thus obtaining an exact height relatively to a Player is harder.

This might be just misbehavior or simply intended, but in both cases it is not stated in the in-game doc and got me to misprogram quite a few spells.

commented

If so, it should be mentioned in the in-game doc. Calling the player's eye position -too late to edit-

commented

I mean, your position is where your eyes are, though...

commented

That is the intended behavior, I believe.

commented

No, it's not. It's where your feet are. The bottom of your feet.

commented

that's not how it's internally stored for players these days.

commented

Debug info begs to differ.

commented

internally, not in nbt...

commented

@yrsegal you're incorrect. all entities are stored serverside and in NBT using their feet position.
in 1.7 and below client players (and only client players) were stored from eye position, but that bug has been fixed in 1.8+

commented

I've gotten debug info showing the player y position as in the head in 1.9. That may have changed since the start, but that's what I remember.

commented

Actually as of 1.9 both eye level and feet level coordinates are shown

commented

it shows both feet and eye, but actual entity.posX/Y/Z is always feet

commented

And again my point still stands: if the way the Position operator works changes depending on entity type, this is misleading and definitely not documented in the mod.

commented

It apparently does now, and it is misleading, I agree. From psi:

Vector3 vec = Vector3.fromEntity(e);
if(e instanceof EntityPlayer) {
    vec.add(0.0D, (double)e.getEyeHeight(), 0.0D);
}

return vec;
commented

My bet is that it was to facilitate raycasting because it is unlocked early.
Easiest fix might be either to add a Constant: Eye height or Operator: Entity feet.
The latter might be mislabeled but that is more or less what it could be.
...or yannow, mention it in the in-game doc.