Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"?" axis is incorrect #6

Closed
khonkhortisan opened this issue Aug 30, 2012 · 2 comments
Closed

"?" axis is incorrect #6

khonkhortisan opened this issue Aug 30, 2012 · 2 comments

Comments

@khonkhortisan
Copy link
Contributor

If I add

spawned = false
minetest.register_globalstep(function(dtime)
        if spawned then
                print(worldedit.player_axis('singleplayer'))
        end
end)

and then add

spawned = true

to any command, then when I run it, it gives me a live ?-to-axis mapping.

Here's how it maps:
Anything above 45° up maps to y.
Looking down doesn't map to y.
From halfway between +z and +x, to +x, to -z, to about 30° clockwise past -z, maps to x.
From about 30° clockwise past -z, to about 30° before -x, maps to y.
From about 30° before -x, to -x, to +z, to halfway between +z and +x, maps to z.

So, with axes like this:
....+z....
-x....+x
....-z....

it maps like this:
zzzzz.
z...|...x
z...|...x
z--+--x
z...|...x
y...|...x
yyxxxx

with y on top. (looking more that 45° vertical maps to y)

Also, looking down (about 45°) on the y side (-x and -z) maps to either x or z (instead of y) depending on your horizontal angle.

Code in question:

worldedit.player_axis = function(name)
        local dir = minetest.env:get_player_by_name(name):get_look_dir()
        if dir.x > dir.y then
                if dir.x > dir.z then
                        return "x"
                end
        elseif dir.y > dir.z then
                return "y"
        end
        return "z"
end

When I first noticed it, I was looking in the -z direction and my microcontrollers stacked in the +x direction.
Speaking of which, the ? axis should return both positive and negative axes, with the functions that use it stripping off the negative sign. When //stacking, the sign of the axis matters.

@Uberi
Copy link
Owner

Uberi commented Aug 30, 2012

Thanks for reporting that; I haven't tested the ? feature extensively, so there are a few issues that probably still remain.

I've got some code in the pipeline, but I'm working on some other things right now so this might need to wait until tomorrow.

@Uberi
Copy link
Owner

Uberi commented Aug 30, 2012

Fixed in 340416c.

@Uberi Uberi closed this as completed Aug 30, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants