Code: Select all
paramtype2 = "facedir"
So is it possible to do this with numbers between 90° or do i have to create "transition nodeboxes"?
Code: Select all
paramtype2 = "facedir"
I wonder if you rotated the node fast enough -- you might be able to take advantage of persistence of vision and maybe give the illusion of it rotating through smaller angles.Jeksta wrote:I know that you can rotate nodeboxes using.
But then you can only rotate the node in 90° steps.Code: Select all
paramtype2 = "facedir"
So is it possible to do this with numbers between 90° or do i have to create "transition nodeboxes"?
If you turn the node into an entity, you can put it at any angle you want, then turn it back. Of course you'd have to have a situation where the node will be facing a cardinal point at the end of its motion, and there won't be very many in motion at once.Jeksta wrote:Hm, would be a nice feature to have, like animating a nodebox.
Thanks anyways.
Code: Select all
minetest.register_node("mod:test", {
tiles={"default_wood.png","default_wood.png","default_wood.png^default_stick.png",},
paramtype2 = "facedir",
groups = {dig_immediate = 3},
on_rightclick = function(pos, node, player, itemstack, pointed_thing)
print(node.param2+1)
minetest.set_node(pos,{name="mod:test",param2=node.param2+1})
end,
})
Thats the solution i currently have too.AiTechEye wrote:Code: Select all
minetest.register_node("mod:test", { tiles={"default_wood.png","default_wood.png","default_wood.png^default_stick.png",}, paramtype2 = "facedir", groups = {dig_immediate = 3}, on_rightclick = function(pos, node, player, itemstack, pointed_thing) print(node.param2+1) minetest.set_node(pos,{name="mod:test",param2=node.param2+1}) end, })
Code: Select all
node.param2 = (node.param2 + 1) % 4
minetest.set_node(pos, node)
Code: Select all
minetest.register_entity("default:entity",{
visual = "cube",
textures={"default_dirt.png","default_dirt.png","default_dirt.png","default_dirt.png","default_dirt.png","default_dirt.png",},
on_activate=function(self, staticdata)
--while entity is spawned/loaded
end,
on_step=function(self,dtime)
local r = self.object:get_rotation()
r.y = r.y + 0.1
self.object:set_rotation(r)
end,
})
minetest.add_entity(pos, "default:entity")
Code: Select all
local attached_entity = {}
minetest.register_entity(
"mod:attached_entity",
{
on_activate = function(self, staticdata, dtime_s)
local entity_pos = self.object:get_pos()
local node_pos = {
x = math.floor(entity_pos.x),
y = math.floor(entity_pos.y) - 1,
z = math.floor(entity_pos.z)
}
local ser_pos = minetest.serialize(node_pos)
attached_entity[ser_pos] = self.object
end,
})
minetest.register_node(
"mod:node",
{
on_construct = function(pos)
local ser_pos = minetest.serialize(pos)
minetest.add_entity({x = pos.x, y = pos.y + 1, z = pos.z}, "mod:attached_entity")
end,
on_destruct = function(pos)
local ser_pos = minetest.serialize(pos)
if attached_entity[ser_pos] then
attached_entity[ser_pos]:remove()
attached_entity[ser_pos] = nil
end
end
})
You should post a separate thread for that, it's not really related to the original post.
Thanks! What I am experimenting with is creating a sort of mini-railroad - like a backyard / playground "toy" and using nodeboxes, because that allows using a simple single node for building the entire "track" and making it look more real / 3D. How would using mesh models impact the game performance and resource usage (RAM and CPU) if used instead of simple nodeboxes?Blockhead wrote: ↑Tue May 17, 2022 05:58I would seriously consider moving to meshes and using degrotate if you need smaller than 90° increments, as long as you only need rotation in the X-Z plane. I put together a small example mod today to demonstrate this: Rotatable Monkey.
You should post a separate thread for that, it's not really related to the original post.
Thanks for the feedback. I will look at that...sorcerykid wrote: ↑Thu Jun 16, 2022 07:11Also worth noting that b3d models support animations. So if you setup a tween for the crank in Blender, then it can rotate automagically without the need for continual on_step calls to rotate the entity itself
Users browsing this forum: No registered users and 8 guests