Jump to content

player.getPosition crashing uninigine on world reload


photo

Recommended Posts

Posted

I am using Unigine::getPlayer to get the currently active player

This grabs the editor player.

Calling player.getName() is fine

calling player.getPosition() causes the engine to crash after restarting on engine restart.

as does player.getTransform()

calling engine.editor.call("controlsGetPosition"); does not cause a crash

any clues?

Posted

Try this:

Player player = Unigine::getPlayer();
PlayerDummy player_node = node_cast(player);

Posted

Try this:

Player player = Unigine::getPlayer();
PlayerDummy player_node = node_cast(player);

 

that does give a clue I do that and I get the following.

throw() core/unigine.h:158: Assertion: 'engine.world.isNode(node) == 1'

Posted

I modified the code in core/scripts/utils.h to the following and it seems to be working so far

 

	Player getPlayer() {
	Player player = engine.editor.getPlayer();
	if(player == NULL || !engine.world.isNode(player)) player = engine.game.getPlayer();
	return player;
}

×
×
  • Create New...