How to render game object in a special way

Hi. I’m new to defold and in need of advise.
I have a game object on scene which i want to move (ignoring screen/scene zoom transformations while moving) to certain gui node and then remove. (may be many objects simultaniously)
One way to do it is move object and change its scale accroding to current zoom level in update function.
It seems to me that it would be more convinient not to render this game object with the rest, but render with gui, while moving it. (is this option available in defold?)
Or should i just remove game object and spawn new gui node and then move this node ?
I wary of last approach (its easy to spawn game objects from factory and just change sprite animation. But in my understanding in case of gui node i should have prototype node for every different case of object.)
Please point me the most convinient way of doing this.

Check out the manuals on render and materials. You have full access to the render pipeline and can render anything any way you want and in any order.


I incorrectly posed question. The gist is not “how to render?” . It is “how to change the way I render runtime”. Basically I have

for i = 1, desired_count do
   objects[i] = factory.create("#factory", get_position(i) )
   msg.post(objects[i], "play_animation", { id = hash(get_name(i) ) })
end

and at later point I want

for i = 1, desired_count do
	if(certain_condition(objects[i]) ) then
		disable_screen_scene_zoom_transformations(objects[i])
		schelude_movement(objects[i])
	end
end

This can be achieved via changing zoom for object along with changing it position in update according to current zoom level (without disable_screen_scene_zoom_transformations(objects[i]) ) . But it seems to me if there is a way to implemenent disable_screen_scene_zoom_transformations , it would be easier. (As in render manual render script exmple to get object rendered not with render.draw(self.tile_pred), render.draw(self.particle_pred) but with render.draw(self.gui_pred) the desired result will be achieved)

You can send messages to the render script and set up any logic in there you need.

msg.post("@render:", "some_msg", { data = 1 })
1 Like