Christuff Posted April 20, 2011 Share Posted April 20, 2011 Hello everyone, First i've to precise that it's my first day with Unigine (so it's probably a basic problem). I want to make a 3rd view of a character like it is done in the demo (player/actor00) So i've taken code from this demo, the camera make the good thing like the demo. But, here is my trouble, instead of going down, my character is going up. Does anyone has a clue of where it can come from ? In the picture attached : blue arrow : getUp of the PlayerActor red arrow : getViewDirection of the PlayerActor physics gravity = -9.81 // done on init, mNode is found before, and represent the object in the screen pa = new PlayerActor(); pa.setPosition(mNode.getWorldPosition()); pa.setMinThetaAngle(20.0f); pa.setMaxThetaAngle(60.0f); pa.setThetaAngle(20.0f); pa.setJumping(2.0f); pa.setPhysicalMass(120); persecutor = new PlayerPersecutor(); persecutor.setControls(0); persecutor.setTarget(pa); persecutor.setAnchor(vec3(0.0f,0.0f,2.0f)); persecutor.setMinDistance(2.0f); persecutor.setMaxDistance(4.0f); persecutor.setMinThetaAngle(20.0f); persecutor.setMaxThetaAngle(60.0f); persecutor.setPosition(vec3(-20.0f,0.0f,2.0f)); engine.game.setPlayer(persecutor); // done on Update mNode.setWorldTransform(pa.getWorldTransform() * rotateX(90.0f) * rotateY(90.0f)); // model need to be rotated. persecutor.setPhiAngle(pa.getPhiAngle()); persecutor.setThetaAngle(pa.getThetaAngle()); Thanks for your help :( Link to comment
eugene.litvinov Posted April 20, 2011 Share Posted April 20, 2011 Maybe cause your PlayerActor stays on mNode, and you move mNode? Link to comment
ulf.schroeter Posted April 20, 2011 Share Posted April 20, 2011 Does anyone has a clue of where it can come from ? Hi Christuff, it's always a good idea to post a functional minimal test case (.world/.cpp) for problem reproduction. Link to comment
Christuff Posted April 20, 2011 Author Share Posted April 20, 2011 Maybe cause your PlayerActor stays on mNode, and you move mNode? Bingo, my char have his collider enabled, god i'll probably never have thinked to that. Hi Christuff, it's always a good idea to post a functional minimal test case (.world/.cpp) for problem reproduction. Noted, i've solved the problem, will think to do it next time. Thanks to both of you for your replies :( Link to comment
Recommended Posts