steve3d Posted May 6, 2013 Posted May 6, 2013 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?
danni.coy Posted May 6, 2013 Posted May 6, 2013 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]
steve3d Posted May 6, 2013 Author Posted May 6, 2013 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.
frustum Posted August 24, 2013 Posted August 24, 2013 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.
Recommended Posts