Aquatix
16-10-2007 22:36:46
I shall try it out tonight (using the version of OgreOde from CVS) and post the results here.
Aquatix
16-10-2007 22:36:46
rewb0rn
17-10-2007 00:12:21
Aquatix
17-10-2007 14:09:57
tuan kuranes
17-10-2007 15:17:54
Aquatix
17-10-2007 20:44:04
No active maintainer
but patch welcome
kungfoomasta
17-10-2007 21:19:18
Aquatix
17-10-2007 22:18:28
tuan kuranes
19-10-2007 15:54:28
kungfoomasta
19-10-2007 18:49:28
Aquatix
20-10-2007 16:15:32
GameObjectManager *npcGameObjMgr;
npcGameObjMgr = GameObjectManager::getSingletonPtr();
Ogre::Vector3 loAAB;
BaseEntity = npcGameObjMgr->mSceneMgr->createEntity(npcName,MeshName);
loAAB = BaseEntity->getBoundingBox().getSize();
BaseNode = npcGameObjMgr->mSceneMgr->getRootSceneNode()->createChildSceneNode(npcName,Ogre::Vector3(locx,locy,locz));
BaseEntNode = BaseNode->createChildSceneNode(npcName+"entnd",Ogre::Vector3(0,-abs(loAAB.y/2+0.15-0.15),0));
BaseEntNode->attachObject(BaseEntity);
SkHeadNode = BaseNode->createChildSceneNode(Ogre::Vector3(1,1,1));
BaseSpace = new OgreOde::SimpleSpace(npcGameObjMgr->mpWorld,npcGameObjMgr->mpSpace);
BaseSpace->setInternalCollisions(false);
BaseBody = new OgreOde::Body(npcGameObjMgr->mpWorld);
BaseNode->attachObject(BaseBody);
BaseBody->setMass(OgreOde::BoxMass(90,Ogre::Vector3(abs(loAAB.x)/2,abs(loAAB.y)/2,abs(loAAB.z)/2)));
BaseBody->setOrientation(orintQuat);
SkBody = new OgreOde::BoxGeometry(Ogre::Vector3(0.5,abs(loAAB.y)-0.37-0.3,abs(loAAB.z))-0.02,npcGameObjMgr->mpWorld,BaseSpace);
SkBody->setBody(BaseBody);
SkHead = new OgreOde::BoxGeometry(Ogre::Vector3(0.18,0.27,0.23),npcGameObjMgr->mpWorld); //убрал BaseSpace
SkHeadTr = new OgreOde::TransformGeometry(npcGameObjMgr->mpWorld,BaseSpace);
SkHead->setPosition(Ogre::Vector3(0,abs(loAAB.y/2-0.2),-0.02));
SkHeadTr->setEncapsulatedGeometry(SkHead);
SkHeadTr->setBody(BaseBody);
BaseRay = new OgreOde::RayGeometry(0.9-0.15,npcGameObjMgr->mpWorld,BaseSpace);
int collideSuccess = 0;
GameObjectManager *npcGameObjMgr = GameObjectManager::getSingletonPtr();
std::map<std::string, TerrainObject*>::iterator itTerrains;
std::map<std::string, TerrainObject*>::iterator itTerrainsEnd;
itTerrains = npcGameObjMgr->mTerrainObjects.begin();
itTerrainsEnd = npcGameObjMgr->mTerrainObjects.end();
BaseBody->setDamping(10,10);
BaseRay->setDefinition(BaseNode->getPosition()+Ogre::Vector3(0,-0.15,0),Ogre::Vector3::NEGATIVE_UNIT_Y);
for (; itTerrains != itTerrainsEnd; ++itTerrains) {
if (BaseRay->collide(itTerrains->second->TerrainGeom,npcGameObjMgr)) { collideSuccess = 1;}
}
if (collideSuccess == 1) {
_isGround = true;
BaseBody->wake();
BaseBody->setPosition(npcGameObjMgr->mpContact->getPosition()+Ogre::Vector3(0,1.05-0.15,0));
BaseBody->setAngularVelocity(Ogre::Vector3(0,0,0));
BaseBody->setLinearVelocity(BaseBody->getLinearVelocity()*Ogre::Vector3(1,0,1));
}
if (_isGround == true) {
BaseBody->setOrientation(Ogre::Quaternion(BaseBody->getOrientation().xAxis(),Ogre::Vector3::UNIT_Y,BaseBody->getOrientation().zAxis()));
_isGround = false;
}
rewb0rn
22-10-2007 21:05:41
cloud9
23-10-2007 20:12:38
kungfoomasta
23-10-2007 21:26:59
Aquatix
24-10-2007 13:39:13
kungfoomasta
24-10-2007 18:42:51
cloud9
24-10-2007 20:38:41
rewb0rn
24-10-2007 22:30:45
kungfoomasta
24-10-2007 23:08:04
rewb0rn
25-10-2007 10:09:03
Aquatix
25-10-2007 16:25:38
Ogre::Entity *pBaseEntity; //Your Player.mesh
Ogre::SceneNode *pBaseNode;
Ogre::SceneNode *pBaseModelNode;
OgreOde::Space *pPhysicsCharSpace;
OgreOde::Body *pBaseBody;
OgreOde::Geometry *pGeomBaseBody;
OgreOde::TransformGeometry *pGeomBody;
OgreOde::Geometry *pGeomBaseHead; //Use this for things like head shots, etc. Surely, you can add arms, legs, whatever you need
OgreOde::TransformGeometry *pGeomHead;
OgreOde::Body *pHeadBody;
OgreOde::RayGeometry *pBaseRay;
pPhysicsCharSpace = new OgreOde::SimpleSpace(pGameObjMgr->mpWorld,pGameObjMgr->mpSpace);
pPhysicsCharSpace->setInternalCollisions(false);
pBaseRay = new OgreOde::RayGeometry(0.90,pGameObjMgr->mpWorld,pPhysicsCharSpace);
pBaseEntity = pGameObjMgr->mSceneMgr->createEntity("PlayerBaseModel","PlayerBase.mesh");
pBaseNode = pGameObjMgr->mSceneMgr->getRootSceneNode()->createChildSceneNode("Player1");
pBaseModelNode = pBaseNode->createChildSceneNode(Ogre::Vector3(0,-1.05,0));
pBaseModelNode->attachObject(pBaseEntity);
pBaseBody = new OgreOde::Body(pGameObjMgr->mpWorld);
pBaseBody->setMass(OgreOde::BoxMass(75,Ogre::Vector3(0.25,0.75,0.15)));
pBaseBody->setAutoSleep(false);
pGeomBaseBody = new OgreOde::BoxGeometry(Ogre::Vector3(0.42,0.7,0.30),pGameObjMgr->mpWorld);
pGeomBody = new OgreOde::TransformGeometry(pGameObjMgr->mpWorld,pPhysicsCharSpace);
pGeomBaseBody->setPosition(Ogre::Vector3(0,0.35,0));
pGeomBody->setEncapsulatedGeometry(pGeomBaseBody);
pGeomBody->setBody(pBaseBody);
pGeomBaseHead = new OgreOde::BoxGeometry(Ogre::Vector3(0.18,0.27,0.23),pGameObjMgr->mpWorld);
pGeomHead = new OgreOde::TransformGeometry(pGameObjMgr->mpWorld,pPhysicsCharSpace);
pGeomBaseHead->setPosition(Ogre::Vector3(0,0.62,0));
pGeomHead->setEncapsulatedGeometry(pGeomBaseHead);
pGeomHead->setBody(pBaseBody);
pBaseNode->attachObject(pBaseBody);
Ogre::Vector3 posVect;
Ogre::Real dataTemp1, charAbsHeight;
OgreOde::Contact *tempContact;
int collideSuccess = 0;
std::map<std::string, TerrainObject*>::iterator itTerrains;
std::map<std::string, TerrainObject*>::iterator itTerrainsEnd;
std::map <std::string, WalkableObject*>::iterator itWalkables;
std::map <std::string, WalkableObject*>::iterator itWalkablesEnd;
itTerrains = pGameObjMgr->mTerrainObjects.begin();
itTerrainsEnd = pGameObjMgr->mTerrainObjects.end();
itWalkables = pGameObjMgr->mWalkableObjects.begin();
itWalkablesEnd = pGameObjMgr->mWalkableObjects.end();
charAbsHeight = pCharAbsHeight;
pCharAbsHeight = pBaseBody->getPosition().y;
pBaseRay->setDefinition(pBaseNode->getPosition()+Ogre::Vector3(0,-0.15,0),Ogre::Vector3::NEGATIVE_UNIT_Y);
for (; itTerrains != itTerrainsEnd; ++itTerrains) {
if (pBaseRay->collide(itTerrains->second->TerrainGeom,pGameObjMgr)) { collideSuccess = 1;}
}
for (; itWalkables != itWalkablesEnd; ++itWalkables) {
if (pBaseRay->collide(itWalkables->second->BaseGeom,pGameObjMgr)) { collideSuccess = 1;}
}
if (collideSuccess == 1) {
if (p_JumpRequest == 0) {
p_isCharGround = true;
pBaseBody->wake();
tempContact = pGameObjMgr->mpContact;
posVect = tempContact->getNormal();
pBaseBody->setPosition(tempContact->getPosition()+Ogre::Vector3(0,1.05,0));
dataTemp1 = Ogre::Math::ACos(posVect.dotProduct(Ogre::Vector3::UNIT_Y)).valueDegrees();
pBaseBody->setAngularVelocity(Ogre::Vector3(0,0,0));
pBaseBody->setLinearVelocity(pBaseBody->getLinearVelocity()*Ogre::Vector3(1,0,1));
}
if (p_JumpRequest == 1) {
Ogre::Vector3 JumpPowerV, JumpPowerVF;
JumpPowerV = Ogre::Vector3(pBaseBody->getLinearVelocity().x/2,pCharJumpHeight,pBaseBody->getLinearVelocity().z/2);
JumpPowerVF = pBaseBody->getOrientation()*Ogre::Vector3(p_MoveSideways/8 * pCharJumpHeight,0,p_MoveForward/10 * pCharJumpHeight);
pBaseBody->setLinearVelocity(JumpPowerVF + JumpPowerV);
p_JumpRequest = 0;
p_isCharGround = false;
}
}
if (p_isCharGround == true) {
if (dataTemp1 == 0) pCharSpeedZ = pCharSpeed*p_MoveForward/10;
else {if (pCharAbsHeight > charAbsHeight)
{if (dataTemp1 > 0 && dataTemp1 < 60) pCharSpeedZ = pCharSpeed*p_MoveForward/30*(1-dataTemp1/90);
if (dataTemp1 >= 60) pCharSpeedZ = 0.001*p_MoveForward;}
else {pCharSpeedZ = pCharSpeed*p_MoveForward/10 * dataTemp1/90;} }
if (dataTemp1 == 0) pCharSpeedX = pCharSpeed*p_MoveSideways/10;
else {if (pCharAbsHeight > charAbsHeight)
{if (dataTemp1 > 0 && dataTemp1 < 60) pCharSpeedX = pCharSpeed*p_MoveSideways/30*(1-dataTemp1/90);
if (dataTemp1 >= 60) pCharSpeedX = 0.001*p_MoveSideways;}
else {pCharSpeedX = pCharSpeed*p_MoveSideways/10 * dataTemp1/90;} }
pBaseBody->setLinearVelocity(pBaseBody->getOrientation()*Ogre::Vector3(pCharSpeedX,0,pCharSpeedZ));
p_isCharGround = false;
}
pBaseBody->setAngularVelocity(Ogre::Vector3::ZERO);
pBaseBody->setOrientation(Ogre::Quaternion(pBaseBody->getOrientation().xAxis(),Ogre::Vector3::UNIT_Y,pBaseBody->getOrientation().zAxis()));
case OIS::KC_W:
gPlayer->p_MoveForward = 10;
gPlayer->p_isCharMoving=true;
break;
case OIS::KC_S:
gPlayer->p_MoveForward = -5;
gPlayer->p_isCharMoving=true;
break;
case OIS::KC_A:
gPlayer->p_MoveSideways = 8;
gPlayer->p_isCharMoving=true;
break;
case OIS::KC_D:
gPlayer->p_MoveSideways = -8;
gPlayer->p_isCharMoving=true;
break;
case OIS::KC_SPACE:
gPlayer->p_JumpRequest = 1;
break;
kungfoomasta
25-10-2007 17:40:54
Aquatix
26-10-2007 14:10:55
case OIS::KC_W:
gPlayer->p_MoveForward = 0;
gPlayer->p_isCharMoving=false;
break;
case OIS::KC_S:
gPlayer->p_MoveForward = 0;
gPlayer->p_isCharMoving=false;
break;
case OIS::KC_A:
gPlayer->p_MoveSideways = 0;
gPlayer->p_isCharMoving=false;
break;
case OIS::KC_D:
gPlayer->p_MoveSideways = 0;
gPlayer->p_isCharMoving=false;
break;
case OIS::KC_SPACE:
gPlayer->p_JumpRequest = 0;
break;
tuan kuranes
26-10-2007 14:16:01
Aquatix
26-10-2007 17:08:24
That said OgreBullet still is behind OgreOde in terms of outofthebox features (vehicles, raggdolls, explosion)
tuan kuranes
26-10-2007 17:26:11
OgreBullet seems to be a good idea to try out, but the CVS demo doesn't work
Aquatix
26-10-2007 17:43:49
Problem is, Dev is making at least a release a week over there...
kungfoomasta
26-10-2007 18:25:43
Aquatix
26-10-2007 18:33:54
It seems like everybody who implements a great character collision class decides not to share it.
kungfoomasta
26-10-2007 18:42:58
Aquatix
26-10-2007 18:47:16
kungfoomasta
26-10-2007 18:50:35
Aquatix
26-10-2007 18:57:31
kungfoomasta
26-10-2007 19:09:37
Aquatix
26-10-2007 19:41:55
kungfoomasta
26-10-2007 19:50:51
Aquatix
26-10-2007 20:03:37
they seem a little more geared towards receiving patches and giving direction
in the short amount of time I've visited their forums.
kungfoomasta
26-10-2007 20:26:56
Grey
26-10-2007 21:30:59
Aquatix
27-10-2007 03:47:09
cloud9
28-10-2007 17:02:53
_world->updateDrawState();
Aquatix
28-10-2007 17:24:02
cloud9
28-10-2007 19:50:34
kungfoomasta
31-10-2007 20:20:05
Aquatix
31-10-2007 21:55:36
Aquatix
11-11-2007 02:05:24
kungfoomasta
11-11-2007 04:00:30
Aquatix
11-11-2007 04:47:57