mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-31 21:45:35 +00:00
more fix. Fargoth quest almost work as in vanilla now.
This commit is contained in:
parent
006f25d1c0
commit
a328a03bd3
4 changed files with 12 additions and 15 deletions
|
@ -339,8 +339,7 @@ namespace MWWorld
|
|||
_from = btVector3(from.x, from.y, from.z);
|
||||
_to = btVector3(to.x, to.y, to.z);
|
||||
|
||||
std::pair<std::string, float> result = mEngine->rayTest(_from, _to, false);//raycastingObjectOnly);
|
||||
std::cout << result.first << " " << result.second;
|
||||
std::pair<std::string, float> result = mEngine->rayTest(_from, _to, raycastingObjectOnly);
|
||||
return !(result.first == "");
|
||||
}
|
||||
|
||||
|
@ -419,7 +418,6 @@ namespace MWWorld
|
|||
OEngine::Physic::RigidBody* raycastingBody = mEngine->createAndAdjustRigidBody(
|
||||
mesh, node->getName(), node->getScale().x, node->getPosition(), node->getOrientation(), 0, 0, true, placeable);
|
||||
mEngine->addRigidBody(body, true, raycastingBody);
|
||||
std::cout << "Object:" << mesh;
|
||||
}
|
||||
|
||||
void PhysicsSystem::addActor (const Ptr& ptr)
|
||||
|
@ -428,7 +426,6 @@ namespace MWWorld
|
|||
Ogre::SceneNode* node = ptr.getRefData().getBaseNode();
|
||||
//TODO:optimize this. Searching the std::map isn't very efficient i think.
|
||||
mEngine->addCharacter(node->getName(), mesh, node->getPosition(), node->getScale().x, node->getOrientation());
|
||||
std::cout << "Actor:" << mesh;
|
||||
}
|
||||
|
||||
void PhysicsSystem::removeObject (const std::string& handle)
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace Physic
|
|||
mRaycastingBody = mEngine->createAndAdjustRigidBody(mMesh, mName, scale, position, rotation, &mBoxScaledTranslation, &mBoxRotation, true);
|
||||
Ogre::Quaternion inverse = mBoxRotation.Inverse();
|
||||
mBoxRotationInverse = btQuaternion(inverse.x, inverse.y, inverse.z,inverse.w);
|
||||
//mEngine->addRigidBody(mBody, false, mRaycastingBody,true); //Add rigid body to dynamics world, but do not add to object map
|
||||
mEngine->addRigidBody(mBody, false, mRaycastingBody,true); //Add rigid body to dynamics world, but do not add to object map
|
||||
}
|
||||
|
||||
PhysicActor::~PhysicActor()
|
||||
|
@ -109,7 +109,7 @@ namespace Physic
|
|||
//Create the newly scaled rigid body
|
||||
mBody = mEngine->createAndAdjustRigidBody(mMesh, mName, scale, pos, rot);
|
||||
mRaycastingBody = mEngine->createAndAdjustRigidBody(mMesh, mName, scale, pos, rot, 0, 0, true);
|
||||
mEngine->addRigidBody(mBody, false, mRaycastingBody); //Add rigid body to dynamics world, but do not add to object map
|
||||
mEngine->addRigidBody(mBody, false, mRaycastingBody,true); //Add rigid body to dynamics world, but do not add to object map
|
||||
}
|
||||
|
||||
Ogre::Vector3 PhysicActor::getHalfExtents() const
|
||||
|
@ -331,8 +331,8 @@ namespace Physic
|
|||
|
||||
mHeightFieldMap [name] = hf;
|
||||
|
||||
dynamicsWorld->addRigidBody(body,CollisionType_World|CollisionType_Raycasting,
|
||||
CollisionType_World|CollisionType_ActorInternal|CollisionType_ActorExternal|CollisionType_Raycasting);
|
||||
dynamicsWorld->addRigidBody(body,CollisionType_HeightMap|CollisionType_Raycasting,
|
||||
CollisionType_World|CollisionType_Actor|CollisionType_Raycasting);
|
||||
}
|
||||
|
||||
void PhysicEngine::removeHeightField(int x, int y)
|
||||
|
@ -430,8 +430,8 @@ namespace Physic
|
|||
const std::string& name = (body ? body->mName : raycastingBody->mName);
|
||||
|
||||
if (body){
|
||||
if(actor) {dynamicsWorld->addRigidBody(body,CollisionType_ActorInternal,CollisionType_World|CollisionType_ActorInternal);std::cout << "actor";}
|
||||
else dynamicsWorld->addRigidBody(body,CollisionType_World,CollisionType_World|CollisionType_ActorInternal|CollisionType_ActorExternal);
|
||||
if(actor) dynamicsWorld->addRigidBody(body,CollisionType_Actor,CollisionType_World|CollisionType_HeightMap);
|
||||
else dynamicsWorld->addRigidBody(body,CollisionType_World,CollisionType_World|CollisionType_Actor|CollisionType_HeightMap);
|
||||
}
|
||||
|
||||
if (raycastingBody)
|
||||
|
@ -613,7 +613,7 @@ namespace Physic
|
|||
float d1 = 10000.;
|
||||
btCollisionWorld::ClosestRayResultCallback resultCallback1(from, to);
|
||||
if(raycastingObjectOnly) resultCallback1.m_collisionFilterMask = CollisionType_Raycasting;
|
||||
else resultCallback1.m_collisionFilterMask = CollisionType_ActorExternal;
|
||||
else resultCallback1.m_collisionFilterMask = CollisionType_World;
|
||||
dynamicsWorld->rayTest(from, to, resultCallback1);
|
||||
if (resultCallback1.hasHit())
|
||||
{
|
||||
|
@ -644,7 +644,7 @@ namespace Physic
|
|||
std::pair<bool, float> PhysicEngine::sphereCast (float radius, btVector3& from, btVector3& to)
|
||||
{
|
||||
OurClosestConvexResultCallback callback(from, to);
|
||||
callback.m_collisionFilterMask = OEngine::Physic::CollisionType_World;
|
||||
callback.m_collisionFilterMask = OEngine::Physic::CollisionType_World|OEngine::Physic::CollisionType_HeightMap;
|
||||
|
||||
btSphereShape shape(radius);
|
||||
const btQuaternion btrot(0.0f, 0.0f, 0.0f);
|
||||
|
|
|
@ -46,8 +46,8 @@ namespace Physic
|
|||
enum CollisionType {
|
||||
CollisionType_Nothing = 0, //<Collide with nothing
|
||||
CollisionType_World = 1<<0, //<Collide with world objects
|
||||
CollisionType_ActorInternal = 1<<1, //<Collide internal capsule Still Used?
|
||||
CollisionType_ActorExternal = 1<<2, //<collide with external capsule Still used?
|
||||
CollisionType_Actor = 1<<1, //<Collide internal capsule Still Used?
|
||||
CollisionType_HeightMap = 1<<2, //<collide with external capsule Still used?
|
||||
CollisionType_Raycasting = 1<<3 //Still used?
|
||||
};
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ void newtrace(traceResults *results, const Ogre::Quaternion& orient, const Ogre:
|
|||
const btTransform to(btorient, btend);
|
||||
|
||||
btCollisionWorld::ClosestConvexResultCallback newTraceCallback(btstart, btend);
|
||||
newTraceCallback.m_collisionFilterMask = OEngine::Physic::CollisionType_World;
|
||||
newTraceCallback.m_collisionFilterMask = OEngine::Physic::CollisionType_World|OEngine::Physic::CollisionType_HeightMap;
|
||||
|
||||
enginePass->dynamicsWorld->convexSweepTest(&newshape, from, to, newTraceCallback);
|
||||
|
||||
|
|
Loading…
Reference in a new issue