czechow
05-05-2006 11:33:41
misterface
05-05-2006 21:21:31
I will make an attempt
1) attach a collision object to the cam
2) make materialpair of that object and your walls
3) make your own collisioncallback (see examples)
4) matpair....->setContactCallback( yourCallback )
that's it I guess, never tried it with a cam though
correct me if i'm wrong
DarkCoder
06-05-2006 01:46:17
Erm, can't check right now but as far as i can remember i did it like this.
Ogre::Camera *camera;
OgreNewt::Body* bod;
Ogre::SceneNode* msnCam;
//Create Your Camera
camera = sceneMgr->createCamera("camera");
//Camera SceneNode
msnCam = sceneMgr->getRootSceneNode()->createChildSceneNode();
//Attatch Camera to the SceneNode
msnCam->attachObject( camera );
//Make Newton collision object
//Ellipsoid
Ogre::Vector3 size( 2.0, 4.0, 2.0 );
OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::Ellipsoid( m_World, size, Ogre::Quaternion::IDENTITY, Ogre::Vector3::ZERO);
//OR a cylinder
Ogre::Vector3 size( 2.0, 2.0, 2.0 );
OgreNewt::Collision* col = new OgreNewt::CollisionPrimitives::Cylinder( m_World, size, Ogre::Quaternion::IDENTITY, Ogre::Vector3::ZERO);
//Attatch collision object to a newton body
bod = new OgreNewt::Body( m_World, col );
//mass & inertia
Ogre::Real mass = size.length();
Ogre::Vector3 inertia = OgreNewt::MomentOfInertia::CalcCylinderSolid( mass, 0.5, 1.3 );
bod->setMassMatrix( mass, inertia );
bod->setAutoFreeze(0); //Dont freeze
//Attatch collision object to camera scene node
bod->attachToNode( msnCam );
//Set callback
bod->setStandardForceCallback();
bod->setCustomForceAndTorqueCallback( fastdelegate::MakeDelegate( this, &OgreNewtonFrameListener::playerCallback ) );
If you still need more help i'll try dissect my camera controller for you as im using my own Framework & no the Example one.
Oh, and nice model btw!
czechow
08-05-2006 10:46:41
Thanks for help I deciced to make collision as in
http://www.ogre3d.org/phpBB2addons/viewtopic.php?p=7194#7194 If to have any exemplary aplication in which collision and camera control are used, I'd be grateful if you could make it accessible.Having access to it would be really helpful and I could learn more.