klarax
23-11-2009 15:17:44
Hi guys,
i have an issue i cant seem to think through correctly and was hoping you could shed some light on things...
I got this demo going where if you can imagine a coconut throw game, where you throw a ball at coconuts to knock them off. Well got the scene all set up, and all is good
Whats getting me is getting the ball to move from the cam to the direction that the camera is facing given the rotation and direction of the camera
I have created the ball at the cam pos but looking at the addforce func, they require vec3's and i think i need some quaternion, or maybe a real for axix of mouse.
I've pasted the small section of code that im trying to implement below:
Hope you can shed some light on this matter for me.
Thanks,
Karax
i have an issue i cant seem to think through correctly and was hoping you could shed some light on things...
I got this demo going where if you can imagine a coconut throw game, where you throw a ball at coconuts to knock them off. Well got the scene all set up, and all is good
Whats getting me is getting the ball to move from the cam to the direction that the camera is facing given the rotation and direction of the camera
I have created the ball at the cam pos but looking at the addforce func, they require vec3's and i think i need some quaternion, or maybe a real for axix of mouse.
I've pasted the small section of code that im trying to implement below:
if(m_pGameState->getState() == BALLS)
{
if(m_iBallCount < NUMBEROFALLOWEDBALLS)
{
//Target Meshes - as Convex
convexMesh = NxOgre::MeshManager::getSingleton()->load("media:ball.nxs");
convex = new NxOgre::Convex(convexMesh);
//Fill Target Array with meshes and position each
m_pRenderSystem = m_pGameState->getRenderSystem();
m_pBallBody[m_iBallCount] = m_pRenderSystem->createBody(convex, m_pCameraNode->getPosition()/*NxOgre::Vec3(900, -2.0, 115)*/, "ball.mesh");
//here i have tried addforce and setvelocity functions but they dont appear to do anything :s
m_iBallCount++;
}
return;
}
Hope you can shed some light on this matter for me.
Thanks,
Karax