Texture orientation using on_place = minetest.rotate_node

Post Reply
dvere
New member
Posts: 4
Joined: Sun Sep 29, 2013 10:53
GitHub: dvere
IRC: dvere
In-game: dvere
Location: UK

Texture orientation using on_place = minetest.rotate_node

by dvere » Post

I'm not sure if this is expected behaviour or if I am doing something wrong.

I have made a simple mod to add Scrabble-like nodebox tiles for my son to play with.

Rotation when placed on the ground is correct but when placed on a vertical surface the texture is always rotated 90 degrees clockwise from the placer's perspective.


Image

I expected the texture when placed on vertical surfaces would, by default, be "upright".

The texture for the tile in the screenshot (tile_bottom.png and tile_sides.png are the same square background without the letter) and a simplified version of the node definition below.

I couldn't see an obvious (to me) reason for why this happens in builtin/common/misc_helpers.lua but I most likley don't know what I'm looking for.

Image

Code: Select all

minetest.register_node('tile:tile_A', {
	description = ("tile A" ),
	drawtype = "nodebox",
	node_box = {
		type = "fixed",
		fixed = { -0.48, -0.5, -0.48, 0.48, -0.28, 0.48 }
	},
	tiles = {
		'tile_A.png',
		'tile_bottom.png',
		'tile_sides.png',
		'tile_sides.png',
		'tile_sides.png',
		'tile_sides.png'
	},
	sunlight_propagates = true,
	paramtype = "light",
	paramtype2 = "facedir",
	walkable = true,
	groups = { snappy = 3 },
	sounds = default.node_sound_wood_defaults(),
	on_place = minetest.rotate_node
})

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Texture orientation using on_place = minetest.rotate_nod

by Don » Post

I am not sure what is wrong but I do hope you add the mod to the forum once it is fixed.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

dvere
New member
Posts: 4
Joined: Sun Sep 29, 2013 10:53
GitHub: dvere
IRC: dvere
In-game: dvere
Location: UK

Re: Texture orientation using on_place = minetest.rotate_nod

by dvere » Post

The below changes to dirs1 and dirs2 in builtin/common/misc_helpers.lua (lines 323 &324) fixes both this and the texture orientation being off by 180 degrees when placing "on the ceiling".

Code: Select all

    local dirs1 = {8, 17, 6, 15}
    local dirs2 = {22, 21, 20, 23}

User avatar
Casimir
Member
Posts: 1206
Joined: Fri Aug 03, 2012 16:59
GitHub: CasimirKaPazi

Re: Texture orientation using on_place = minetest.rotate_nod

by Casimir » Post

That seems to be a bigger problem. With signlike/wallmounted it is even more distorted that with nodebox.
Without your fix:
http://screenshot.ru/upload/images/2014 ... 4d8148.png
With your fix it gets better:
http://screenshot.ru/upload/images/2014 ... 5e7f71.png

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Texture orientation using on_place = minetest.rotate_nod

by Don » Post

You could do an on_place replace node and create another node with the rotated image. It would work as a temporary solution til you get a better answer. Not a good solution but better then nothing.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

dvere
New member
Posts: 4
Joined: Sun Sep 29, 2013 10:53
GitHub: dvere
IRC: dvere
In-game: dvere
Location: UK

Re: Texture orientation using on_place = minetest.rotate_nod

by dvere » Post

Casimir wrote:That seems to be a bigger problem. With signlike/wallmounted it is even more distorted that with nodebox.
Without your fix:
http://screenshot.ru/upload/images/2014 ... 4d8148.png
With your fix it gets better:
http://screenshot.ru/upload/images/2014 ... 5e7f71.png
Using minetest.rotate_node is appropriate for nodes that have "paramtype2 = facedir" but not "drawtype = signlike" or "paramtype2 = wallmounted" as those would be placed facing the player as opposed to being placed facing in the direction the player is looking.
Don wrote:You could do an on_place replace node and create another node with the rotated image. It would work as a temporary solution til you get a better answer. Not a good solution but better then nothing.
I'm happy with the above fix as it is working how I think it was intended, means that the node definition is simple and doesn't seem to have broken anything else!

Though it's really nothing much I've put the mod on github. https://github.com/dvere/scrabble

They respond to a poke with a screwdriver even without the fix :-D

User avatar
Don
Member
Posts: 1643
Joined: Sat May 17, 2014 18:40
GitHub: DonBatman
IRC: Batman
In-game: Batman

Re: Texture orientation using on_place = minetest.rotate_nod

by Don » Post

I wanted to use this mod but I see that the rotate thing isn't fixed yet. I added ^[transformR90 to the letter png. This rotates the letter to work on the wall but means when placing on the ground you has to place from the side. Just think this might be a better solution.
Many of my mods are now a part of Minetest-mods. A place where you know they are maintained!

A list of my mods can be found here

Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests