Advanced Peripherals

Advanced Peripherals

29M Downloads

Item / function to get player position and rotation data

jig487 opened this issue ยท 6 comments

commented

Describe your idea

Currently I'm working on a Hologram API that will let you define things in the 3d maths space of minecraft coordinates and then render them in the AR goggles. A command that grabs the position and rotation of the player would be immensely helpful, and I'm sure would have uses outside of what I'm doing.

Describe alternatives you've considered if you've any

Currently this function is what I've been using to get the player pos and rot data.

local function getData()) --Grabs player head rotation and pos
    local _, rot = commands.exec("data get entity "..playerName.." Rotation")
    local rot = string.match(textutils.serialize(rot[1]) , "%d+%p+%d" , 33 + #playerName)--This doesn't work yet. Need to fix the string match
    for i = 1, 3 do
        _, playerPos[i] = commands.exec("data get entity "..playerName.." Pos["..(i-1).."]")
        playerPos[i] = string.match(textutils.serialize(playerPos[i]) , "%d+%p+%d" , 32 + #playerName) --This doesn't work yet. Need to fix the string match
    end
end

Additional context

No response

Linked Issues

No response

commented

I will add a memory card compatibility for the player detector, so you can access specific player functions if a memory card is inserted

commented

Could you send me a list of functions or information you want to have?

commented

I will change the milestone to 0.8r because we need to rework our network system(This is also for the AR Rework). So we will do that in 0.8

commented

Functions:
drawline( x1, y1, x2, y2, size, color)

drawpolygon( table, size, color ) --Plug in a table that maybe looks like this:

fillpolygon( table, color) --Same thing but fills it in

table = {
{ x, y },
{ x, y},
{ x, y}
}
it iterates through the table, connecting the 1st set to the 2nd set with a line, and the 2nd to the 3rd, and so on until it loops back with the last to the first.

Information:`
Player rotation values
more accurate Player position
Sense when the player left / right clicks with the goggles on

commented

ope didn't mean to do that

commented

Not directly added to the AR Controller
But there is now yaw and pitch in the getPlayerPos() function of the player detector in 0.7.4r