#(aviside) How to detect if a player is facing an entity's back?

43 messages · Page 1 of 1 (latest)

hollow dagger
#

So I need to do a check that ensures the player is facing another entity's back almost square on, how do I check for this?

cerulean marshBOT
#

(aviside) How to detect if a player is facing an entity's back?

cerulean marshBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.

raw sedge
#

check the facing direction of both entities and see if they face said direction is close enough together

#

!t entity.location.yaw

orchid impBOT
#
Possible Confusion

Did you mean to search for entitytag.location?

raw sedge
#

!t location.yaw

orchid impBOT
hollow dagger
#

Okay, I'm not sure what to do with the two values

#

what tags do I need to determine the position from those values?

#

I tried subbing one from the other and checking if it was a low number but it gives inconsistent results

raw sedge
#

you will need to keep in mind that yaw goes from 0-360, so you would need to be careful are the border area when 360 becomes 0 again

#

but otherwise you just check if player1 yaw is about equal to player2 yaw (like within + or - 2 degrees? up to you how much wiggle room you want)

hollow dagger
#

Yeah I'm trying to check if it's close enough but idk how to do it

#

the difference tag isn't giving me the numbers I expected

raw sedge
#

what is it giving you?

hollow dagger
#

numbers 8 - 12 when I compare the difference for their yaws

#

like sometimes it's 53 and 348 and it says the difference is 10

raw sedge
#

!debug

orchid impBOT
# raw sedge !debug
Info: debug

If you need help with a script issue, one of the most powerful tools Denizen has to offer is full debug output. This is displaying in your console whenever scripts are running until you turn debug off. To share a debug log quickly and easily with helpers, simply run the command /denizen debug -r in-game to begin recording, then run through the part of the script you need help with, then run the command /denizen submit. This will give you a link to a paste of the debug log, which you can then copy/paste back to us!

hollow dagger
#

and the script

raw sedge
#

eh

#

!t element.sub

orchid impBOT
hollow dagger
#

yeah I tried that but I got inconsistent results

raw sedge
#

difference is not sub

#

difference is a completely unrelated thing

hollow dagger
#

okay

#

I just wanted a way to grab difference between positive/negative values

raw sedge
#

!t element.abs

orchid impBOT
raw sedge
#

you can use this to flip anything negative to positive

hollow dagger
#

oh okay cool

hazy prawnBOT
#
Resolved

Thread closed as resolved.

hollow dagger
hazy prawnBOT
#
Thread Reopened

Thread was manually reopened by @hollow dagger.

hollow dagger
#

idk how to deal with the lower values and high values too

#

yeah it'll work for the right angles lol but not when the yaw wraps around for another entity

hazy prawnBOT
#
Changed to Help/Support

Thread is now a Help/Support thread. A helper will check your thread when available.