#49 Directional Signs off axis rotation?

Lezárt
megnyitva ekkor: 4 éve daniel1 által · 5 hozzászólás
daniel1 hozzászólt 4 éve

So apparently degrotate supports meshes for plantlike objects... and found a post where you mentioned making a tool which asked for param2 value....

was wondering what it would take to make directional signs be rotated via a dialog...? so you place the sign and look in the direction you want it to point... F5... get the degree and then type that into the sign to reorient it

The only thing is the sign would have to be plantlike

So apparently degrotate supports meshes for plantlike objects... and found a post where you mentioned making a tool which asked for param2 value.... was wondering what it would take to make directional signs be rotated via a dialog...? so you place the sign and look in the direction you want it to point... F5... get the degree and then type that into the sign to reorient it The only thing is the sign would have to be plantlike
daniel1 hozzászólt 4 éve
Bejelentő

So i tried it...

after_place_node = function(pos, placer)

local meta = minetest.get_meta(pos)

meta:set_string('owner',placer:get_player_name())

local yaw = placer:get_look_horizontal()

local param = math.floor(yaw * 90 / math.pi + 0.5)

local n = minetest.get_node(pos)

n.param2 = param

minetest.set_node(pos, n)

end,

But this only works when mesh is changed to plantlike....

however there is a train mod which uses mesh & degrotate together...

So i tried it... after_place_node = function(pos, placer) local meta = minetest.get_meta(pos) meta:set_string('owner',placer:get_player_name()) local yaw = placer:get_look_horizontal() local param = math.floor(yaw * 90 / math.pi + 0.5) local n = minetest.get_node(pos) n.param2 = param minetest.set_node(pos, n) end, But this only works when mesh is changed to plantlike.... however there is a train mod which uses mesh & degrotate together...
NathanS21 hozzászólt 4 éve
Tulajdonos

I don't think it's possible to use meshes with degrotate, the train mod might be uses entities to display the items that are rotated.

I don't think it's possible to use meshes with degrotate, the train mod might be uses entities to display the items that are rotated.
daniel1 hozzászólt 4 éve
Bejelentő
local function place_degrotate(pos, placer, itemstack, pointed_thing)
local yaw = placer:get_look_horizontal()
local param = math.floor(yaw * 90 / math.pi + 0.5)
local n = minetest.get_node(pos)
n.param2 = param
minetest.set_node(pos, n)
 end

 minetest.register_node("advtrains_signals_ks:mast", {
drawtype = "mesh",
paramtype="light",
paramtype2="degrotate",
walkable = false,
selection_box = {
    type = "fixed",
    fixed = {-1/4, -1/2, -1/4, 1/4, 1/2, 1/4},
},
mesh = "advtrains_signals_ks_mast.obj",
tiles = {"advtrains_signals_ks_mast.png"},
description="Ks Signal Mast",
sunlight_propagates=true,
groups = {
    cracky=3,
    not_blocking_trains=1,
    --save_in_at_nodedb=2,
},
after_place_node = place_degrotate,
})
local function place_degrotate(pos, placer, itemstack, pointed_thing) local yaw = placer:get_look_horizontal() local param = math.floor(yaw * 90 / math.pi + 0.5) local n = minetest.get_node(pos) n.param2 = param minetest.set_node(pos, n) end minetest.register_node("advtrains_signals_ks:mast", { drawtype = "mesh", paramtype="light", paramtype2="degrotate", walkable = false, selection_box = { type = "fixed", fixed = {-1/4, -1/2, -1/4, 1/4, 1/2, 1/4}, }, mesh = "advtrains_signals_ks_mast.obj", tiles = {"advtrains_signals_ks_mast.png"}, description="Ks Signal Mast", sunlight_propagates=true, groups = { cracky=3, not_blocking_trains=1, --save_in_at_nodedb=2, }, after_place_node = place_degrotate, })
daniel1 hozzászólt 4 éve
Bejelentő
https://github.com/minetest-mirrors/advtrains/blob/master/advtrains_signals_ks/init_degrotate_nodes.lua
NathanS21 hozzászólt 4 éve
Tulajdonos

``*paramtype2 = "degrotate"`

* Only valid for "plantlike" drawtype. The rotation of the node is stored in
  `param2`.
* Values range 0 - 179. The value stored in `param2` is multiplied by two to
  get the actual rotation in degrees of the node.```

The code you linked doesn't work, it runs just fine, but the node doesn't get rotated. The Param2 value is set correctly, but the mesh doesn't get rotated.

```* `paramtype2 = "degrotate"` * Only valid for "plantlike" drawtype. The rotation of the node is stored in `param2`. * Values range 0 - 179. The value stored in `param2` is multiplied by two to get the actual rotation in degrees of the node.``` The code you linked doesn't work, it runs just fine, but the node doesn't get rotated. The Param2 value is set correctly, but the mesh doesn't get rotated.
NathanS21 lezárta ekkor: 4 éve
Jelentkezzen be hogy csatlakozhasson a beszélgetéshez.
Nincs mérföldkő
Nincs megbízott
2 Résztvevő
Töltés...
Mégse
Mentés
Még nincs tartalom.