mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 10:23:56 +00:00
Merge remote-tracking branch 'zini/master' into animations
This commit is contained in:
commit
03a6190c5a
18 changed files with 231 additions and 34 deletions
|
@ -331,6 +331,10 @@ namespace MWBase
|
|||
virtual void activateDoor(const MWWorld::Ptr& door) = 0;
|
||||
///< activate (open or close) an non-teleport door
|
||||
|
||||
virtual bool getPlayerStandingOn (const MWWorld::Ptr& object) = 0; ///< @return true if the player is standing on \a object
|
||||
virtual bool getActorStandingOn (const MWWorld::Ptr& object) = 0; ///< @return true if any actor is standing on \a object
|
||||
virtual float getWindSpeed() = 0;
|
||||
|
||||
virtual void setupExternalRendering (MWRender::ExternalRendering& rendering) = 0;
|
||||
|
||||
virtual int canRest() = 0;
|
||||
|
|
|
@ -137,8 +137,7 @@ namespace MWClass
|
|||
fJumpAcrobaticsBase = gmst.find("fJumpAcrobaticsBase");
|
||||
fJumpAcroMultiplier = gmst.find("fJumpAcroMultiplier");
|
||||
fJumpRunMultiplier = gmst.find("fJumpRunMultiplier");
|
||||
// Added in Tribunal/Bloodmoon, may not exist
|
||||
fWereWolfRunMult = gmst.search("fWereWolfRunMult");
|
||||
fWereWolfRunMult = gmst.find("fWereWolfRunMult");
|
||||
|
||||
inited = true;
|
||||
}
|
||||
|
|
|
@ -331,5 +331,12 @@ op 0x2000208: MoveWorld
|
|||
op 0x2000209: MoveWorld, explicit
|
||||
op 0x200020a: Fall
|
||||
op 0x200020b: Fall, explicit
|
||||
op 0x200020c: GetStandingPC
|
||||
op 0x200020d: GetStandingPC, explicit
|
||||
op 0x200020e: GetStandingActor
|
||||
op 0x200020f: GetStandingActor, explicit
|
||||
op 0x2000210: GetStartingAngle
|
||||
op 0x2000211: GetStartingAngle, explicit
|
||||
op 0x2000212: GetWindSpeed
|
||||
|
||||
opcodes 0x200020c-0x3ffffff unused
|
||||
opcodes 0x2000213-0x3ffffff unused
|
||||
|
|
|
@ -565,6 +565,40 @@ namespace MWScript
|
|||
}
|
||||
};
|
||||
|
||||
template <class R>
|
||||
class OpGetStandingPc : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
runtime.push (MWBase::Environment::get().getWorld()->getPlayerStandingOn(ptr));
|
||||
}
|
||||
};
|
||||
|
||||
template <class R>
|
||||
class OpGetStandingActor : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
MWWorld::Ptr ptr = R()(runtime);
|
||||
runtime.push (MWBase::Environment::get().getWorld()->getActorStandingOn(ptr));
|
||||
}
|
||||
};
|
||||
|
||||
class OpGetWindSpeed : public Interpreter::Opcode0
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void execute (Interpreter::Runtime& runtime)
|
||||
{
|
||||
runtime.push(MWBase::Environment::get().getWorld()->getWindSpeed());
|
||||
}
|
||||
};
|
||||
|
||||
const int opcodeXBox = 0x200000c;
|
||||
const int opcodeOnActivate = 0x200000d;
|
||||
const int opcodeActivate = 0x2000075;
|
||||
|
@ -608,6 +642,11 @@ namespace MWScript
|
|||
const int opcodeGetSquareRoot = 0x20001e7;
|
||||
const int opcodeFall = 0x200020a;
|
||||
const int opcodeFallExplicit = 0x200020b;
|
||||
const int opcodeGetStandingPc = 0x200020c;
|
||||
const int opcodeGetStandingPcExplicit = 0x200020d;
|
||||
const int opcodeGetStandingActor = 0x200020e;
|
||||
const int opcodeGetStandingActorExplicit = 0x200020f;
|
||||
const int opcodeGetWindSpeed = 0x2000212;
|
||||
|
||||
const int opcodePlayBink = 0x20001f7;
|
||||
|
||||
|
@ -650,6 +689,9 @@ namespace MWScript
|
|||
extensions.registerInstruction ("setdelete", "l", opcodeSetDelete, opcodeSetDeleteExplicit);
|
||||
extensions.registerFunction ("getsquareroot", 'f', "f", opcodeGetSquareRoot);
|
||||
extensions.registerInstruction ("fall", "", opcodeFall, opcodeFallExplicit);
|
||||
extensions.registerFunction ("getstandingpc", 'l', "", opcodeGetStandingPc, opcodeGetStandingPcExplicit);
|
||||
extensions.registerFunction ("getstandingactor", 'l', "", opcodeGetStandingActor, opcodeGetStandingActorExplicit);
|
||||
extensions.registerFunction ("getwindspeed", 'f', "", opcodeGetWindSpeed);
|
||||
}
|
||||
|
||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||
|
@ -698,7 +740,11 @@ namespace MWScript
|
|||
interpreter.installSegment5 (opcodeGetSquareRoot, new OpGetSquareRoot);
|
||||
interpreter.installSegment5 (opcodeFall, new OpFall<ImplicitRef>);
|
||||
interpreter.installSegment5 (opcodeFallExplicit, new OpFall<ExplicitRef>);
|
||||
|
||||
interpreter.installSegment5 (opcodeGetStandingPc, new OpGetStandingPc<ImplicitRef>);
|
||||
interpreter.installSegment5 (opcodeGetStandingPcExplicit, new OpGetStandingPc<ExplicitRef>);
|
||||
interpreter.installSegment5 (opcodeGetStandingActor, new OpGetStandingActor<ImplicitRef>);
|
||||
interpreter.installSegment5 (opcodeGetStandingActorExplicit, new OpGetStandingActor<ExplicitRef>);
|
||||
interpreter.installSegment5 (opcodeGetWindSpeed, new OpGetWindSpeed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -247,15 +247,15 @@ namespace MWScript
|
|||
|
||||
if(axis == "x")
|
||||
{
|
||||
runtime.push(ptr.getRefData().getPosition().pos[0]);
|
||||
runtime.push(ptr.getCellRef().mPos.pos[0]);
|
||||
}
|
||||
else if(axis == "y")
|
||||
{
|
||||
runtime.push(ptr.getRefData().getPosition().pos[1]);
|
||||
runtime.push(ptr.getCellRef().mPos.pos[1]);
|
||||
}
|
||||
else if(axis == "z")
|
||||
{
|
||||
runtime.push(ptr.getRefData().getPosition().pos[2]);
|
||||
runtime.push(ptr.getCellRef().mPos.pos[2]);
|
||||
}
|
||||
else
|
||||
throw std::runtime_error ("invalid axis: " + axis);
|
||||
|
@ -721,6 +721,8 @@ namespace MWScript
|
|||
const int opcodeSetPosExplicit = 0x2000193;
|
||||
const int opcodeGetStartingPos = 0x2000194;
|
||||
const int opcodeGetStartingPosExplicit = 0x2000195;
|
||||
const int opcodeGetStartingAngle = 0x2000210;
|
||||
const int opcodeGetStartingAngleExplicit = 0x2000211;
|
||||
const int opcodePosition = 0x2000196;
|
||||
const int opcodePositionExplicit = 0x2000197;
|
||||
const int opcodePositionCell = 0x2000198;
|
||||
|
@ -765,6 +767,7 @@ namespace MWScript
|
|||
extensions.registerInstruction("setatstart","",opcodeSetAtStart,opcodeSetAtStartExplicit);
|
||||
extensions.registerInstruction("move","cf",opcodeMove,opcodeMoveExplicit);
|
||||
extensions.registerInstruction("moveworld","cf",opcodeMoveWorld,opcodeMoveWorldExplicit);
|
||||
extensions.registerFunction("getstartingangle",'f',"c",opcodeGetStartingAngle,opcodeGetStartingAngleExplicit);
|
||||
}
|
||||
|
||||
void installOpcodes (Interpreter::Interpreter& interpreter)
|
||||
|
@ -804,6 +807,8 @@ namespace MWScript
|
|||
interpreter.installSegment5(opcodeMoveExplicit,new OpMove<ExplicitRef>);
|
||||
interpreter.installSegment5(opcodeMoveWorld,new OpMoveWorld<ImplicitRef>);
|
||||
interpreter.installSegment5(opcodeMoveWorldExplicit,new OpMoveWorld<ExplicitRef>);
|
||||
interpreter.installSegment5(opcodeGetStartingAngle, new OpGetStartingAngle<ImplicitRef>);
|
||||
interpreter.installSegment5(opcodeGetStartingAngleExplicit, new OpGetStartingAngle<ExplicitRef>);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,11 +11,11 @@ MWWorld::Ptr::CellStore *MWWorld::Cells::getCellStore (const ESM::Cell *cell)
|
|||
{
|
||||
if (cell->mData.mFlags & ESM::Cell::Interior)
|
||||
{
|
||||
std::map<std::string, Ptr::CellStore>::iterator result = mInteriors.find (cell->mName);
|
||||
std::map<std::string, Ptr::CellStore>::iterator result = mInteriors.find (Misc::StringUtils::lowerCase(cell->mName));
|
||||
|
||||
if (result==mInteriors.end())
|
||||
{
|
||||
result = mInteriors.insert (std::make_pair (cell->mName, Ptr::CellStore (cell))).first;
|
||||
result = mInteriors.insert (std::make_pair (Misc::StringUtils::lowerCase(cell->mName), Ptr::CellStore (cell))).first;
|
||||
}
|
||||
|
||||
return &result->second;
|
||||
|
|
|
@ -171,6 +171,25 @@ namespace MWWorld
|
|||
return ptr;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
const T *insertStatic(const T &x) {
|
||||
Store<T> &store = const_cast<Store<T> &>(get<T>());
|
||||
if (store.search(x.mId) != 0) {
|
||||
std::ostringstream msg;
|
||||
msg << "Try to override existing record '" << x.mId << "'";
|
||||
throw std::runtime_error(msg.str());
|
||||
}
|
||||
T record = x;
|
||||
|
||||
T *ptr = store.insertStatic(record);
|
||||
for (iterator it = mStores.begin(); it != mStores.end(); ++it) {
|
||||
if (it->second == &store) {
|
||||
mIds[ptr->mId] = it->first;
|
||||
}
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
// This method must be called once, after loading all master/plugin files. This can only be done
|
||||
// from the outside, so it must be public.
|
||||
void setUp();
|
||||
|
|
|
@ -74,15 +74,6 @@ namespace MWWorld
|
|||
|
||||
mVariables.insert (std::make_pair (iter->mId, std::make_pair (type, value)));
|
||||
}
|
||||
|
||||
if (mVariables.find ("dayspassed")==mVariables.end())
|
||||
{
|
||||
// vanilla Morrowind does not define dayspassed.
|
||||
Data value;
|
||||
value.mLong = 1; // but the addons start counting at 1 :(
|
||||
|
||||
mVariables.insert (std::make_pair ("dayspassed", std::make_pair ('l', value)));
|
||||
}
|
||||
}
|
||||
|
||||
const Globals::Data& Globals::operator[] (const std::string& name) const
|
||||
|
|
|
@ -501,7 +501,7 @@ namespace MWWorld
|
|||
|
||||
bool PhysicsSystem::toggleCollisionMode()
|
||||
{
|
||||
for(std::map<std::string,OEngine::Physic::PhysicActor*>::iterator it = mEngine->PhysicActorMap.begin(); it != mEngine->PhysicActorMap.end();it++)
|
||||
for(std::map<std::string,OEngine::Physic::PhysicActor*>::iterator it = mEngine->mActorMap.begin(); it != mEngine->mActorMap.end();it++)
|
||||
{
|
||||
if (it->first=="player")
|
||||
{
|
||||
|
|
|
@ -92,6 +92,7 @@ namespace MWWorld
|
|||
std::map<std::string, T> mDynamic;
|
||||
|
||||
typedef std::map<std::string, T> Dynamic;
|
||||
typedef std::map<std::string, T> Static;
|
||||
|
||||
friend class ESMStore;
|
||||
|
||||
|
@ -183,6 +184,20 @@ namespace MWWorld
|
|||
return ptr;
|
||||
}
|
||||
|
||||
T *insertStatic(const T &item) {
|
||||
std::string id = Misc::StringUtils::lowerCase(item.mId);
|
||||
std::pair<typename Static::iterator, bool> result =
|
||||
mStatic.insert(std::pair<std::string, T>(id, item));
|
||||
T *ptr = &result.first->second;
|
||||
if (result.second) {
|
||||
mShared.push_back(ptr);
|
||||
} else {
|
||||
*ptr = item;
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
||||
bool eraseStatic(const std::string &id) {
|
||||
T item;
|
||||
item.mId = Misc::StringUtils::lowerCase(id);
|
||||
|
|
|
@ -65,7 +65,7 @@ WeatherManager::WeatherManager(MWRender::RenderingManager* rendering,MWWorld::Fa
|
|||
mHour(14), mCurrentWeather("clear"), mFirstUpdate(true), mWeatherUpdateTime(0),
|
||||
mThunderFlash(0), mThunderChance(0), mThunderChanceNeeded(50), mThunderSoundDelay(0),
|
||||
mRemainingTransitionTime(0), mMonth(0), mDay(0),
|
||||
mTimePassed(0), mFallback(fallback)
|
||||
mTimePassed(0), mFallback(fallback), mWindSpeed(0.f)
|
||||
{
|
||||
mRendering = rendering;
|
||||
//Globals
|
||||
|
@ -367,6 +367,8 @@ void WeatherManager::update(float duration)
|
|||
else
|
||||
result = getResult(mCurrentWeather);
|
||||
|
||||
mWindSpeed = result.mWindSpeed;
|
||||
|
||||
mRendering->configureFog(result.mFogDepth, result.mFogColor);
|
||||
|
||||
// disable sun during night
|
||||
|
@ -653,3 +655,8 @@ void WeatherManager::changeWeather(const std::string& region, const unsigned int
|
|||
if (Misc::StringUtils::ciEqual(region, playerRegion))
|
||||
setWeather(weather);
|
||||
}
|
||||
|
||||
float WeatherManager::getWindSpeed() const
|
||||
{
|
||||
return mWindSpeed;
|
||||
}
|
||||
|
|
|
@ -131,6 +131,8 @@ namespace MWWorld
|
|||
|
||||
void setHour(const float hour);
|
||||
|
||||
float getWindSpeed() const;
|
||||
|
||||
void setDate(const int day, const int month);
|
||||
|
||||
void advanceTime(double hours)
|
||||
|
@ -143,6 +145,7 @@ namespace MWWorld
|
|||
private:
|
||||
float mHour;
|
||||
int mDay, mMonth;
|
||||
float mWindSpeed;
|
||||
MWWorld::Fallback* mFallback;
|
||||
void setFallbackWeather(Weather& weather,const std::string& name);
|
||||
MWRender::RenderingManager* mRendering;
|
||||
|
|
|
@ -211,6 +211,10 @@ namespace MWWorld
|
|||
mStore.load (mEsm[idx]);
|
||||
}
|
||||
|
||||
// insert records that may not be present in all versions of MW
|
||||
if (mEsm[0].getFormat() == 0)
|
||||
ensureNeededRecords();
|
||||
|
||||
mStore.setUp();
|
||||
|
||||
// global variables
|
||||
|
@ -230,6 +234,41 @@ namespace MWWorld
|
|||
}
|
||||
|
||||
|
||||
void World::ensureNeededRecords()
|
||||
{
|
||||
if (!mStore.get<ESM::GameSetting>().search("sCompanionShare"))
|
||||
{
|
||||
ESM::GameSetting sCompanionShare;
|
||||
sCompanionShare.mId = "sCompanionShare";
|
||||
ESM::Variant value;
|
||||
value.setType(ESM::VT_String);
|
||||
value.setString("Companion Share");
|
||||
sCompanionShare.mValue = value;
|
||||
mStore.insertStatic(sCompanionShare);
|
||||
}
|
||||
if (!mStore.get<ESM::Global>().search("dayspassed"))
|
||||
{
|
||||
// vanilla Morrowind does not define dayspassed.
|
||||
ESM::Global dayspassed;
|
||||
dayspassed.mId = "dayspassed";
|
||||
ESM::Variant value;
|
||||
value.setType(ESM::VT_Long);
|
||||
value.setInteger(1); // but the addons start counting at 1 :(
|
||||
dayspassed.mValue = value;
|
||||
mStore.insertStatic(dayspassed);
|
||||
}
|
||||
if (!mStore.get<ESM::GameSetting>().search("fWereWolfRunMult"))
|
||||
{
|
||||
ESM::GameSetting fWereWolfRunMult;
|
||||
fWereWolfRunMult.mId = "fWereWolfRunMult";
|
||||
ESM::Variant value;
|
||||
value.setType(ESM::VT_Float);
|
||||
value.setFloat(1.f);
|
||||
fWereWolfRunMult.mValue = value;
|
||||
mStore.insertStatic(fWereWolfRunMult);
|
||||
}
|
||||
}
|
||||
|
||||
World::~World()
|
||||
{
|
||||
delete mWeatherManager;
|
||||
|
@ -1583,4 +1622,28 @@ namespace MWWorld
|
|||
return !mDoorStates[door]; // if currently opening or closing, then do the opposite
|
||||
return door.getRefData().getLocalRotation().rot[2] == 0;
|
||||
}
|
||||
|
||||
bool World::getPlayerStandingOn (const MWWorld::Ptr& object)
|
||||
{
|
||||
MWWorld::Ptr player = mPlayer->getPlayer();
|
||||
if (!mPhysEngine->getCharacter("player")->getOnGround())
|
||||
return false;
|
||||
btVector3 from (player.getRefData().getPosition().pos[0], player.getRefData().getPosition().pos[1], player.getRefData().getPosition().pos[2]);
|
||||
btVector3 to = from - btVector3(0,0,5);
|
||||
std::pair<std::string, float> result = mPhysEngine->rayTest(from, to);
|
||||
return result.first == object.getRefData().getBaseNode()->getName();
|
||||
}
|
||||
|
||||
bool World::getActorStandingOn (const MWWorld::Ptr& object)
|
||||
{
|
||||
return mPhysEngine->isAnyActorStandingOn(object.getRefData().getBaseNode()->getName());
|
||||
}
|
||||
|
||||
float World::getWindSpeed()
|
||||
{
|
||||
if (isCellExterior() || isCellQuasiExterior())
|
||||
return mWeatherManager->getWindSpeed();
|
||||
else
|
||||
return 0.f;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,9 +115,11 @@ namespace MWWorld
|
|||
void addContainerScripts(const Ptr& reference, Ptr::CellStore* cell);
|
||||
void PCDropped (const Ptr& item);
|
||||
|
||||
virtual void processDoors(float duration);
|
||||
void processDoors(float duration);
|
||||
///< Run physics simulation and modify \a world accordingly.
|
||||
|
||||
void ensureNeededRecords();
|
||||
|
||||
public:
|
||||
|
||||
World (OEngine::Render::OgreRenderer& renderer,
|
||||
|
@ -381,6 +383,10 @@ namespace MWWorld
|
|||
virtual void activateDoor(const MWWorld::Ptr& door);
|
||||
///< activate (open or close) an non-teleport door
|
||||
|
||||
virtual bool getPlayerStandingOn (const MWWorld::Ptr& object); ///< @return true if the player is standing on \a object
|
||||
virtual bool getActorStandingOn (const MWWorld::Ptr& object); ///< @return true if any actor is standing on \a object
|
||||
virtual float getWindSpeed();
|
||||
|
||||
virtual void setupExternalRendering (MWRender::ExternalRendering& rendering);
|
||||
|
||||
virtual int canRest();
|
||||
|
|
|
@ -98,10 +98,12 @@ namespace Compiler
|
|||
|
||||
if (type!=' ')
|
||||
{
|
||||
getErrorHandler().error ("catoLowern't re-declare local variable", loc);
|
||||
/// \todo add option to make re-declared local variables an error
|
||||
getErrorHandler().warning ("can't re-declare local variable", loc);
|
||||
SkipParser skip (getErrorHandler(), getContext());
|
||||
scanner.scan (skip);
|
||||
return false;
|
||||
mState = EndState;
|
||||
return true;
|
||||
}
|
||||
|
||||
mLocals.declare (mState==ShortState ? 's' : (mState==LongState ? 'l' : 'f'),
|
||||
|
|
|
@ -428,7 +428,12 @@ namespace Compiler
|
|||
if (get (c))
|
||||
{
|
||||
if (c=='=')
|
||||
{
|
||||
special = S_cmpLE;
|
||||
|
||||
if (get (c) && c!='=') // <== is a allowed as an alternative to <= :(
|
||||
putback (c);
|
||||
}
|
||||
else
|
||||
{
|
||||
putback (c);
|
||||
|
@ -443,7 +448,12 @@ namespace Compiler
|
|||
if (get (c))
|
||||
{
|
||||
if (c=='=')
|
||||
{
|
||||
special = S_cmpGE;
|
||||
|
||||
if (get (c) && c!='=') // >== is a allowed as an alternative to >= :(
|
||||
putback (c);
|
||||
}
|
||||
else
|
||||
{
|
||||
putback (c);
|
||||
|
|
|
@ -267,8 +267,8 @@ namespace Physic
|
|||
}
|
||||
}
|
||||
|
||||
PhysicActorContainer::iterator pa_it = PhysicActorMap.begin();
|
||||
for (; pa_it != PhysicActorMap.end(); ++pa_it)
|
||||
PhysicActorContainer::iterator pa_it = mActorMap.begin();
|
||||
for (; pa_it != mActorMap.end(); ++pa_it)
|
||||
{
|
||||
if (pa_it->second != NULL)
|
||||
{
|
||||
|
@ -567,13 +567,13 @@ namespace Physic
|
|||
|
||||
|
||||
//dynamicsWorld->addAction( newActor->mCharacter );
|
||||
PhysicActorMap[name] = newActor;
|
||||
mActorMap[name] = newActor;
|
||||
}
|
||||
|
||||
void PhysicEngine::removeCharacter(const std::string &name)
|
||||
{
|
||||
PhysicActorContainer::iterator it = PhysicActorMap.find(name);
|
||||
if (it != PhysicActorMap.end() )
|
||||
PhysicActorContainer::iterator it = mActorMap.find(name);
|
||||
if (it != mActorMap.end() )
|
||||
{
|
||||
PhysicActor* act = it->second;
|
||||
if(act != NULL)
|
||||
|
@ -581,16 +581,16 @@ namespace Physic
|
|||
|
||||
delete act;
|
||||
}
|
||||
PhysicActorMap.erase(it);
|
||||
mActorMap.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
PhysicActor* PhysicEngine::getCharacter(const std::string &name)
|
||||
{
|
||||
PhysicActorContainer::iterator it = PhysicActorMap.find(name);
|
||||
if (it != PhysicActorMap.end() )
|
||||
PhysicActorContainer::iterator it = mActorMap.find(name);
|
||||
if (it != mActorMap.end() )
|
||||
{
|
||||
PhysicActor* act = PhysicActorMap[name];
|
||||
PhysicActor* act = mActorMap[name];
|
||||
return act;
|
||||
}
|
||||
else
|
||||
|
@ -700,4 +700,22 @@ namespace Physic
|
|||
max = btVector3(0,0,0);
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
bool PhysicEngine::isAnyActorStandingOn (const std::string& objectName)
|
||||
{
|
||||
for (PhysicActorContainer::iterator it = mActorMap.begin(); it != mActorMap.end(); ++it)
|
||||
{
|
||||
if (!it->second->getOnGround())
|
||||
continue;
|
||||
Ogre::Vector3 pos = it->second->getPosition();
|
||||
btVector3 from (pos.x, pos.y, pos.z);
|
||||
btVector3 to = from - btVector3(0,0,5);
|
||||
std::pair<std::string, float> result = rayTest(from, to);
|
||||
if (result.first == objectName)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -288,6 +288,8 @@ namespace Physic
|
|||
|
||||
void setSceneManager(Ogre::SceneManager* sceneMgr);
|
||||
|
||||
bool isAnyActorStandingOn (const std::string& objectName);
|
||||
|
||||
/**
|
||||
* Return the closest object hit by a ray. If there are no objects, it will return ("",-1).
|
||||
*/
|
||||
|
@ -329,7 +331,7 @@ namespace Physic
|
|||
RigidBodyContainer mRaycastingObjectMap;
|
||||
|
||||
typedef std::map<std::string, PhysicActor*> PhysicActorContainer;
|
||||
PhysicActorContainer PhysicActorMap;
|
||||
PhysicActorContainer mActorMap;
|
||||
|
||||
Ogre::SceneManager* mSceneMgr;
|
||||
|
||||
|
|
Loading…
Reference in a new issue