Well before I get into it a bit about myself, I run 3 computers soon to be 4 in my room. A server .a laptop and a 2.6GHZ Dual Core, 64 AMD, Radeon Hd 2400 Pro, 2gb ddr ram. Belkin wireless F5D7000 card (for my Ubuntu partition) acer computer. I use NDISWrapper 1.52 for my main my machines ubuntu partition. Revision 1.51 for my 2 Gnome ubuntu desktops. And I don't need one for my laptop. I am so surronded by computers that they emmit more heat than your average 25 degree (Celsius) day. My server runs NST VM security Tool same with my laptop and they both have TShark, Wireshark, Nmap, and my Laptop has etheral. I don't want to get middle man hacked any time soon :D
In otherwords, I code a lot and I use GNU/Linux as well as a Windows partition in case I can't get my shit together.
Now onto the 3rd person rotation algorithms. I cannot be assed to translate this into Pseudo get over it.
Code: Select all
if(keys[KEY_ESCAPE])
{
if (guiState == false)
{
GUI();
}
keys[KEY_ESCAPE] = false;
}
if (keys[KEY_KEY_W])
{
playerpos.X += speed * cos((playerrot.Y) * 3.14/ 180);
playerpos.Z -= speed * sin((playerrot.Y) * 3.14/180);
// keys[KEY_KEY_W] = false;
}
if (keys[KEY_KEY_S])
{
playerpos.X -= speed * cos((playerrot.Y) * 3.14/180);
playerpos.Z += speed * sin((playerrot.Y) * 3.14/180);
// keys[KEY_KEY_S] = false;
}
if (keys[KEY_KEY_A])
{
playerrot.Y -= 6;
//keys[KEY_KEY_A] = false;
}
if (keys[KEY_KEY_D])
{
playerrot.Y += 6;
// keys[KEY_KEY_D] = false;
}
if(keys[KEY_KEY_R])
{
playerpos = vector3df(0,0,0);
keys[KEY_KEY_R] = false;
}
if(keys[KEY_KEY_Q])
{
playerpos.X -= speed * cos((playerrot.Y +90) * 3.14/ 180);
playerpos.Z += speed * sin((playerrot.Y+ 90) * 3.14/180);
// keys[KEY_KEY_Q] = false;
}
if(keys[KEY_KEY_E])
{
playerpos.X += speed * cos((playerrot.Y +90) * 3.14/ 180);
playerpos.Z -= speed * sin((playerrot.Y+ 90) * 3.14/180);
// keys[KEY_KEY_E] = false;
}
sonic_node->setPosition(playerpos);
sonic_node->setRotation(vector3df(playerrot.X, (playerrot.Y-90), playerrot.Z));
sonic_node->addChild(camera);
vector3df cameratarg = playerpos;
cameratarg.Y += 200;
camera->setTarget(cameratarg);
By not returning the state it provides smoother movement. sin* cos* Trig.. But its applying to a 360 circle. Umm I used to use decorates or whatever but simplified it... That runs in one of my apps called Sonic Revolution.
Um now onto your editors if you email me the source I will make them into GUI capable applications with OS independent engines. The engines I use work on Windows, Mac, Linux, Solaris, Xbox, PS3, I am helping with a port for the WII.
Also what framework do you have for the project? I have some advice on that.
Umm.
* CGame
* CGameManager
* CGameState
* CGamePlayState
* CGamePlayStateLevel01
CGame contains the game loop, and references to CGameManager put an object in the CGame class so you can access it for the loop.
CGameManager
This class is responsible for controlling the game flow logic using a 'State Pattern' approach.
CGameState
The main base state class, all states inherit from here. The 3 main functions, Init(), Update() and Clear().
CGamePlay
Inherits from CGameState to provide general game play functionality
Enjoy.
CGamePlayLevel01
Loads the level.
Anyway I will catch up with you guys later..
Some demo code for CGame would look like..
Code: Select all
bool CGame::Run()
{
while (m_GameManager.device->run())
{
m_GameManager.Run();
}
}
Ugh sorry for the rabble anyway. Hello!
www.dejaigames.com