Jump to content

Problem with Player node


photo

Recommended Posts

In editor, when i try to create a camera parented to bone_transform (which also parented to skinned_mesh & it is all in the layer),

somtimes, when load/quit editor i get changing of camera coordinates in local space (but i do not change camera loacl transform).

i try to find something in the editor what can change my camera, i found it & fix:

 

data\core\editor\editor_controls.h

		// game player
	Player p = engine.game.getPlayer();
	if(p != NULL) {
		engine.console.print("editor try to change game.player!\n");
		//p.setPosition(player.getPosition()); < this code changes transform of game.player
		//p.setRotation(player.getRotation()); < if it is active before loading
		player.setMaterials(p.getMaterials());
	} else {
		player.setMaterials("");
	}

is it bug, or it needed for some purpose?

i think that editor must change nodes only if a user want it.

 

also, i use in my scene the next code to determine my PlayerNode activity (in update event)

	if (engine.editor.isLoaded() == false) {
		engine.game.setPlayer(main_camera);
	} else {
		engine.game.setPlayer(NULL);
	}

 

is it right way to do what i want?

Link to comment
  • 1 month later...

Yep, if that works for you, it is absolutely fine. The editor has its own camera and it sets camera transformations so that on exiting the editor you still get the same image in the viewport. It's made for faster edit-play turnaround.

Link to comment
×
×
  • Create New...