Jump to content

[SOLVED] PlayerDummy's position and direction won't update if directly set model view matrix


photo

Recommended Posts

Posted

I'm trying to create AR project in unigine, and I'm using ARToolkit plus as AR sdk, artoolkit can give a direct model view matrix which can perectly used in unigine.

 

But I found another problem, which is if I created a new PlayerDummy, and directly set modelview matrix on it, the player's postion, direction won't be updated as new modelview matrix's value, then If I set this player to current player, all things are rendered wrong, shadows, gui..

 

So is this a bug of setModelview function of a Player. Or, this there any other way to set these properties with a given modelview matrix?

Posted

I can confirm this the following code has no effect on the viewport

int render() {
	Player player = Unigine::getPlayer();
        player.setControlled(0);
	mat4 mv = player.getModelview();
	
	mat4 out = mv*translate(10,0,0);
	player.setModelview(out);

	player.flushTransform();
	return 1;
}

am I missing something? [edit] I am running in game mode[/edit]

Posted

just googled some articles about this, seems there is no easy way to get eyepos/dir/up from modelview matrix.

 

and I've found one about how to calculate on this, always geting position of vec3_zero..

 

waiting unigine guys or some math master to help me on this.

  • 3 months later...
Posted

Danny, Just set inverse of your modelview matrix to the player world transformation.

 

player.setWorldTransform(inverse(out));

Or you can use player's offset matrix to simulate small movements.

×
×
  • Create New...