mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 10:23:56 +00:00
Fixed NPC activation. Might require some more work when NPC physic will be used.
Note: some NPC seems to be smaller than other, but for now, the capsule shae size is the same for every NPC
This commit is contained in:
parent
26b9d0fdc3
commit
0a55fe0219
2 changed files with 11 additions and 7 deletions
|
@ -34,8 +34,8 @@ namespace Physic
|
||||||
externalGhostObject = new PairCachingGhostObject(name);
|
externalGhostObject = new PairCachingGhostObject(name);
|
||||||
externalGhostObject->setWorldTransform( transform );
|
externalGhostObject->setWorldTransform( transform );
|
||||||
|
|
||||||
btScalar externalCapsuleHeight = 130;
|
btScalar externalCapsuleHeight = 120;
|
||||||
btScalar externalCapsuleWidth = 16;
|
btScalar externalCapsuleWidth = 19;
|
||||||
|
|
||||||
externalCollisionShape = new btCapsuleShapeZ( externalCapsuleWidth, externalCapsuleHeight );
|
externalCollisionShape = new btCapsuleShapeZ( externalCapsuleWidth, externalCapsuleHeight );
|
||||||
externalCollisionShape->setMargin( 0.1 );
|
externalCollisionShape->setMargin( 0.1 );
|
||||||
|
@ -47,8 +47,8 @@ namespace Physic
|
||||||
internalGhostObject = new PairCachingGhostObject(name);
|
internalGhostObject = new PairCachingGhostObject(name);
|
||||||
internalGhostObject->setWorldTransform( transform );
|
internalGhostObject->setWorldTransform( transform );
|
||||||
//internalGhostObject->getBroadphaseHandle()->s
|
//internalGhostObject->getBroadphaseHandle()->s
|
||||||
btScalar internalCapsuleHeight = 120;
|
btScalar internalCapsuleHeight = 110;
|
||||||
btScalar internalCapsuleWidth = 15;
|
btScalar internalCapsuleWidth = 17;
|
||||||
|
|
||||||
internalCollisionShape = new btCapsuleShapeZ( internalCapsuleWidth, internalCapsuleHeight );
|
internalCollisionShape = new btCapsuleShapeZ( internalCapsuleWidth, internalCapsuleHeight );
|
||||||
internalCollisionShape->setMargin( 0.1 );
|
internalCollisionShape->setMargin( 0.1 );
|
||||||
|
@ -62,6 +62,8 @@ namespace Physic
|
||||||
|
|
||||||
mCharacter->mCollision = false;
|
mCharacter->mCollision = false;
|
||||||
setGravity(0);
|
setGravity(0);
|
||||||
|
|
||||||
|
mTranslation = btVector3(0,0,70);
|
||||||
}
|
}
|
||||||
|
|
||||||
PhysicActor::~PhysicActor()
|
PhysicActor::~PhysicActor()
|
||||||
|
@ -113,7 +115,7 @@ namespace Physic
|
||||||
|
|
||||||
btVector3 PhysicActor::getPosition(void)
|
btVector3 PhysicActor::getPosition(void)
|
||||||
{
|
{
|
||||||
return internalGhostObject->getWorldTransform().getOrigin();
|
return internalGhostObject->getWorldTransform().getOrigin() -mTranslation;
|
||||||
}
|
}
|
||||||
|
|
||||||
btQuaternion PhysicActor::getRotation(void)
|
btQuaternion PhysicActor::getRotation(void)
|
||||||
|
@ -123,8 +125,8 @@ namespace Physic
|
||||||
|
|
||||||
void PhysicActor::setPosition(const btVector3& pos)
|
void PhysicActor::setPosition(const btVector3& pos)
|
||||||
{
|
{
|
||||||
internalGhostObject->getWorldTransform().setOrigin(pos);
|
internalGhostObject->getWorldTransform().setOrigin(pos+mTranslation);
|
||||||
externalGhostObject->getWorldTransform().setOrigin(pos);
|
externalGhostObject->getWorldTransform().setOrigin(pos+mTranslation);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
|
@ -89,6 +89,8 @@ namespace Physic
|
||||||
btCollisionShape* externalCollisionShape;
|
btCollisionShape* externalCollisionShape;
|
||||||
|
|
||||||
std::string mName;
|
std::string mName;
|
||||||
|
|
||||||
|
btVector3 mTranslation;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue