http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=25288
this is what im working on but, i have a problem that others have had and their solutions havent seemed to work for my game.
Problem : I need the camera to be a chase camera that follows the trolley, its simple. the code is even easy to get the position as explained in this wonderful tutorial
http://www.gamedev.net/reference/articl ... le1591.asp
The Physics is a different turning type (as in radians or degrees, polar, euler or quats whatever thats about)
Problem : The camera rotates only between 270 and 90, and when it reaches each number it goes backward, giving the illusion your trolley has lost control, lol.
Ideas : Thought maybe this helps, but it didnt yet (cos i didnt change the physics internally)
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=25409
Or this explains it well with a picture even,
http://irrlicht.sourceforge.net/phpBB2/ ... hp?t=24934
Below is the code im using (cut out the bold section its identical (as my logic tells me,even))
Code: Select all
void g_game::updatecam()
{
f32 yrot = g_trolley->getRotation().Y;
f32 xpos = g_trolley->getPosition().X;
f32 zpos = g_trolley->getPosition().Z;
[b]
core::matrix4 mat;
mat.setRotationDegrees(vector3df(0,yrot,0));
core::vector3df yrot1 = mat.getRotationDegrees();[/b]
f32 camerax = camDist* sin((yrot1.Y) * 3.142 / 180) + xpos;
f32 cameraz = camDist* cos((yrot1.Y) * 3.142 / 180) + zpos;
cam->setPosition(core::vector3df(camerax,30,cameraz));
cam->setTarget(g_trolley->getPosition());
}
Its not the game code,its the test code but i need to understand why the camera wont follow a 360 degree oath behind the object...
FOR REFERENCE {}
http://irrlicht.sourceforge.net/phpBB2/ ... ee2#138995
I am using Tumle. The code is free and small, have a look at the
CControllablePhysicsNode For where it rotates the object, but please,
i am not asking for working code (tho, that is great ) i want to understand, not copy paste as much. i think i understand why its not working, but how do i fix it. I cant upload a demo atm, ill try lower the file size first to test. so you can see i f i cant be helped...
Thanks for the help