Anonymous avatar Anonymous committed b40fe4b

Added physical triggers
Updated event system
Updated python wrapper

Comments (0)

Files changed (21)

PolyMain/include/core/PolyCore.h

 #include "PolyEngine.h"
 #include "PolyTaskManager.h"
 #include "PolyResourceManager.h"
+#include "PolyEventHub.h"
 
 /** @} */
 

PolyMain/include/core/PolyEngine.cpp

 		}
 	}
 
+	void Engine::setGameplayStepTime(ulong t) {
+		mGameplayStepTime = t;
+	}
+
 	void Engine::initialiseImpl() {
 		POLY_ASSERT(!mInitialized);
 
 				uint steps = 0;
 				while(accumulator >= mGameplayStepTime && steps < maxStepCount) {
 					stepGameplay();
+					gEnv.globalEventHub->update();
 
 					accumulator -= mGameplayStepTime;
 					++steps;

PolyMain/include/core/PolyEngine.h

 		/** Get the constant amount of time used to step the gameplay every frame.
 		*/
 		ulong						getGameplayStepTime() const;
+		void						setGameplayStepTime(ulong t);
 
 		/// Get the log base name passed to the constructor.
 		const String&				getLogBaseName() const;

PolyMain/include/core/PolyEventHub.cpp

 
 
 namespace Poly {
-	void EventHub::submit(const Event& event) {
-		EventCallbackMap::iterator itr;
-		itr = mCallbacks.find(event.identifier);
+	void EventHub::submit(const Event& event, bool buffered) {
+		if(buffered) {
+			mEventBuffer.push_back(event);
+		}
+		else {
+			EventCallbackMap::iterator itr;
+			itr = mCallbacks.find(event.identifier);
 
-		if(itr != mCallbacks.end()) {
-			Signal* sig = (*itr).second;
-			(*sig)(event);
+			if(itr != mCallbacks.end()) {
+				Signal* sig = (*itr).second;
+				(*sig)(event);
+			}
+		}
+	}
+
+	void EventHub::update() {
+		const uint bufferSize = mEventBuffer.size();
+		for(uint i = 0; i < bufferSize; ++i) {
+			const Event& event = mEventBuffer.front();
+			submit(event, false);
+
+			mEventBuffer.pop_front();
 		}
 	}
 }

PolyMain/include/core/PolyEventHub.h

 	*/
 	class _PolyExport EventHub {
 	public:
-		void submit(const Event& event);
+		void submit(const Event& event, bool buffered=true);
 
 		template<typename F>
-		void registerCallback(const String& identifier, F func);
+		void subscribe(const String& identifier, F func);
+		template<typename F>
+		void subscribe(const InternString& identifier, F func);
+
+		/** Call this every frame to deliver buffered Events.
+		*/
+		void update();
 
 	protected:
 		typedef boost::signal<void (const Event&)> Signal;
 		typedef multimap< InternString, Signal* >::type EventCallbackMap;
 		EventCallbackMap mCallbacks;
+
+		typedef list<Event>::type EventContainer;
+		EventContainer mEventBuffer;
 	};
 
 	template<typename F>
-	void EventHub::registerCallback(const String& identifier, F func) {
-		InternString _identifier(identifier);
+	void EventHub::subscribe(const String& identifier, F func) {
+		subscribe(InternString(identifier), func);
+	}
 
+	template<typename F>
+	void EventHub::subscribe(const InternString& identifier, F func) {
 		EventCallbackMap::iterator itr;
-		itr = mCallbacks.find(_identifier);
+		itr = mCallbacks.find(identifier);
 
 		if(itr != mCallbacks.end())
 			(*itr).second->connect(func);
 			Signal* sig = new Signal();
 			sig->connect(func);
 
-			mCallbacks.insert(std::make_pair(_identifier, sig));
+			mCallbacks.insert(std::make_pair(identifier, sig));
 		}
 	}
 }

PolyMain/include/game/PolyBoxColliderComponent.cpp

 	POLY_CLASS_IMPL(BoxColliderComponent,);
 
 	BoxColliderComponent::BoxColliderComponent()
-	:	mOffset(Vector3::ZERO) {
+	:	mOffset(Vector3::ZERO),
+		mSimulationShape(true),
+		mSceneQueryShape(true) {
 		mProperties.addProperty("Extends", &mExtends);
 		mProperties.addProperty("Offset", &mOffset, true);
+		mProperties.addProperty("SimulationShape", &mSimulationShape, true);
+		mProperties.addProperty("SceneQueryShape", &mSceneQueryShape, true);
+		mProperties.addProperty("TriggerShape", &mTriggerShape, false);
 	}
 
 	void BoxColliderComponent::_notifyOtherComponentAdded(Component* other) {
 		if(physicsC->rigidActor->getScene())
 			mEntity.getLevel().getPhysics()->removeActor(*physicsC->rigidActor);
 
-		physicsC->rigidActor->createShape(physx::PxBoxGeometry(mExtends.x, mExtends.y, mExtends.z), *defaultMaterial, transform);
+		physx::PxShape* shape;
+		shape = physicsC->rigidActor->createShape(physx::PxBoxGeometry(mExtends.x, mExtends.y, mExtends.z), *defaultMaterial, transform);
+		shape->setFlag(physx::PxShapeFlag::eSIMULATION_SHAPE, mSimulationShape);
+		shape->setFlag(physx::PxShapeFlag::eSCENE_QUERY_SHAPE, mSceneQueryShape);
+		shape->setFlag(physx::PxShapeFlag::eTRIGGER_SHAPE, mTriggerShape);
+
 		mEntity.getLevel().getPhysics()->addActor(*physicsC->rigidActor);
 	}
 }

PolyMain/include/game/PolyBoxColliderComponent.h

 	protected:
 		Vector3			mExtends;
 		Vector3			mOffset;
+		bool			mSimulationShape;
+		bool			mSceneQueryShape;
+		bool			mTriggerShape;
 	};
 }
 

PolyMain/include/game/PolyEntityLogic.h

 	*/
 	class _PolyExport EntityLogic {
 	public:
+		enum ComponentSetOperator {
+			CSO_AND,
+			CSO_OR
+		};
+
 		/** Constructor
 		@param componentsOfInterest The Components this logic subscribes to. 
 		@param name Used for debug purposes.
 
 		const String&			getName() const;
 		const ComponentNameSet&	getComponentsOfInterest() const;
+		ComponentSetOperator	getComponentSetOperator() const;
 
 		/** Update Entities with Component types of interest.
 		@param entities The entities containing the component type.
 	protected:
 		String					mName;
 		ComponentNameSet		mComponentsOfInterest;
+		ComponentSetOperator	mComponentSetOperator;
 	};
 
 	inline EntityLogic::EntityLogic(const String& name)
-	:	mName(name) {
+	:	mName(name),
+		mComponentSetOperator(CSO_AND) {
 	}
 
 	inline EntityLogic::~EntityLogic() {
 	inline const ComponentNameSet& EntityLogic::getComponentsOfInterest() const {
 		return mComponentsOfInterest;
 	}
+
+	inline EntityLogic::ComponentSetOperator EntityLogic::getComponentSetOperator() const {
+		return mComponentSetOperator;
+	}
 }
 
 #endif

PolyMain/include/game/PolyEntityManager.cpp

 
 			EntityVector entitiesOfInterest;
 
-			BOOST_FOREACH(Entity entity, mEntities) {
-				bool interested = true;
-				BOOST_FOREACH(const InternString& name, logic->getComponentsOfInterest()) {
-					if(!entity.hasComponent(name)) {
-						interested = false;
-						break;
+			if(logic->getComponentSetOperator() == EntityLogic::CSO_AND) {
+				BOOST_FOREACH(Entity entity, mEntities) {
+					bool interested = true;
+					BOOST_FOREACH(const InternString& name, logic->getComponentsOfInterest()) {
+						if(!entity.hasComponent(name)) {
+							interested = false;
+							break;
+						}
+					}
+					if(interested) {
+						entitiesOfInterest.push_back(entity);
 					}
 				}
-				if(interested) {
-					entitiesOfInterest.push_back(entity);
+			}
+			else {
+				BOOST_FOREACH(Entity entity, mEntities) {
+					BOOST_FOREACH(const InternString& name, logic->getComponentsOfInterest()) {
+						if(entity.hasComponent(name)) {
+							entitiesOfInterest.push_back(entity);
+							break;
+						}
+					}
 				}
 			}
 

PolyMain/include/game/PolyLevel.h

 
 namespace Poly {
 	class RenderDrawUtil;
-
+	
 	/**
 	@ingroup Game
 	*/
 
 		LevelID						getID() const;
 
-		Ogre::SceneManager*			getSceneMgr() const { POLY_ASSERT(isValid()); return msSceneMgr[mID]; }
-		RenderDrawUtil*				getDraw2D() const { POLY_ASSERT(isValid()); return msDraw2D[mID]; }
-		physx::PxScene*				getPhysics() const { POLY_ASSERT(isValid()); return msPhysics[mID]; }
+		Ogre::SceneManager*			getSceneMgr() const;
+		RenderDrawUtil*				getDraw2D() const;
+		physx::PxScene*				getPhysics() const;
 
 	private:
 		LevelID						mID;
 	inline LevelID Level::getID() const {
 		return mID;
 	}
+
+	inline Ogre::SceneManager* Level::getSceneMgr() const {
+		POLY_ASSERT(isValid());
+		return msSceneMgr[mID];
+	}
+	inline RenderDrawUtil* Level::getDraw2D() const {
+		POLY_ASSERT(isValid());
+		return msDraw2D[mID];
+	}
+	inline physx::PxScene* Level::getPhysics() const {
+		POLY_ASSERT(isValid());
+		return msPhysics[mID];
+	}
 }
 
 #endif

PolyMain/include/game/PolyLightComponent.cpp

 	POLY_CLASS_IMPL(LightComponent,);
 
 	LightComponent::LightComponent() {
-		mProperties.addProperty("Light/Type", (String*)POLY_NULLPTR);
-		mProperties.addProperty("Light/Visible", (int*)POLY_NULLPTR, true);
-		mProperties.addProperty("Light/Direction", (Vector3*)POLY_NULLPTR, true);
-		mProperties.addProperty("Light/ShadowFarClipDistance", (float*)POLY_NULLPTR, true);
+		mProperties.addProperty("Type", (String*)POLY_NULLPTR);
+		mProperties.addProperty("Visible", (int*)POLY_NULLPTR, true);
+		mProperties.addProperty("Direction", (Vector3*)POLY_NULLPTR, true);
+		mProperties.addProperty("ShadowFarClipDistance", (float*)POLY_NULLPTR, true);
 
 		gEnv.render->_registerComponent(this);
 	}
 
 		light = mEntity.getLevel().getSceneMgr()->createLight();
 
-		String type = values.get<String>("Light/Type", "point");
+		String type = values.get<String>("Type", "point");
 		StringUtil::toLowerCase(type);
 		if(type == "point")
 			light->setType(Ogre::Light::LT_POINT);
 		else if(type == "directional")
 			light->setType(Ogre::Light::LT_DIRECTIONAL);
 
-		bool visible = values.get<int>("Light/Visible", 1) != 0;
+		bool visible = values.get<int>("Visible", 1) != 0;
 		light->setVisible(visible);
 
-		Vector3 direction = values.get<Vector3>("Light/Direction", Vector3(1, 0, 0));
+		Vector3 direction = values.get<Vector3>("Direction", Vector3(1, 0, 0));
 		light->setDirection(direction);
 
-		float lightRangeInner = values.get<float>("Light/Range/Inner", 0.9f);
-		float lightRangeOuter = values.get<float>("Light/Range/Outer", 0.8f);
+		float lightRangeInner = values.get<float>("Range/Inner", 0.9f);
+		float lightRangeOuter = values.get<float>("Range/Outer", 0.8f);
 		light->setSpotlightRange(Ogre::Radian(lightRangeInner), Ogre::Radian(lightRangeOuter));
 
-		bool castShadows = values.get<int>("Light/CastShadows", 0) != 0;
+		bool castShadows = values.get<int>("CastShadows", 0) != 0;
 		light->setCastShadows(castShadows);
 
-		float shadowFarClipDistance = values.get<float>("Light/ShadowFarClipDistance", -1.0f);
+		float shadowFarClipDistance = values.get<float>("ShadowFarClipDistance", -1.0f);
 		light->setShadowFarClipDistance(shadowFarClipDistance);
 
-		ColourValue diffuseColour = values.get<ColourValue>("Light/DiffuseColour", ColourValue::White);
+		ColourValue diffuseColour = values.get<ColourValue>("DiffuseColour", ColourValue::White);
 		light->setDiffuseColour(diffuseColour);
 
-		float attenuationRange = values.get<float>("Light/Attenuation/Range", 1000.0f);
-		float attenuationConstant = values.get<float>("Light/Attenuation/Constant", 1.0f);
-		float attenuationLinear = values.get<float>("Light/Attenuation/Linear", 0.0045f);
-		float attenuationQuadric = values.get<float>("Light/Attenuation/Quadric", 0.0075f);
+		float attenuationRange = values.get<float>("Attenuation/Range", 1000.0f);
+		float attenuationConstant = values.get<float>("Attenuation/Constant", 1.0f);
+		float attenuationLinear = values.get<float>("Attenuation/Linear", 0.0045f);
+		float attenuationQuadric = values.get<float>("Attenuation/Quadric", 0.0075f);
 		light->setAttenuation(attenuationRange, attenuationConstant, attenuationLinear, attenuationQuadric);
 
-		float power = values.get<float>("Light/Power", 1.0f);
+		float power = values.get<float>("Power", 1.0f);
 		light->setPowerScale(power);
 	}
 

PolyMain/include/game/PolyPhysicsDynamicComponent.cpp

 	PhysicsDynamicComponent::PhysicsDynamicComponent()
 	:	mKinematic(false) {
 		mProperties.addProperty("Kinematic", &mKinematic, true);
+		mProperties.addProperty("Position", (Vector3*)POLY_NULLPTR, true);
+		mProperties.addProperty("Orientation", (Quaternion*)POLY_NULLPTR, true);
 	}
 
 	PhysicsDynamicComponent::~PhysicsDynamicComponent() {
 	void PhysicsDynamicComponent::initialize(Entity entity, const StringVariantMap& values) {
 		PhysicsComponent::initialize(entity, values);
 
-		rigidActor = rigidDynamic = gEnv.physics->createDynamicRigidBody(Vector3::ZERO, Quaternion::IDENTITY, entity);
+		Vector3 position = values.get<Vector3>("Position", Vector3::ZERO);
+		Quaternion q = values.get<Quaternion>("Orientation", Quaternion::IDENTITY);
+
+		rigidActor = rigidDynamic = gEnv.physics->createDynamicRigidBody(position, q, entity);
 		rigidDynamic->setRigidDynamicFlag(physx::PxRigidDynamicFlag::eKINEMATIC, mKinematic);
 	}
 
-	void PhysicsDynamicComponent::setKinetic(bool val) {
+	void PhysicsDynamicComponent::setKinematic(bool val) {
 		mKinematic = val;
 		rigidDynamic->setRigidDynamicFlag(physx::PxRigidDynamicFlag::eKINEMATIC, val);
 	}

PolyMain/include/game/PolyPhysicsDynamicComponent.h

 		
 		virtual void			initialize(Entity entity, const StringVariantMap& values);
 
-		void					setKinetic(bool val);
+		void					setKinematic(bool val);
 		bool					isKinematic() const;
 
 		POLY_CLASS;

PolyMain/include/game/PolyPhysicsEntityLogic.cpp

 namespace Poly {
 	PhysicsEntityLogic::PhysicsEntityLogic()
 	:	EntityLogic("Physics") {
-		mComponentsOfInterest.insert(InternString("Physics"));
+		mComponentsOfInterest.insert(InternString("PhysicsDynamicComponent"));
+		mComponentsOfInterest.insert(InternString("PhysicsStaticComponent"));
+		mComponentSetOperator = CSO_OR;
 	}
 
 	void PhysicsEntityLogic::updateEntitiesOfInterest(const EntityVector& entities) {

PolyMain/include/physics/PolyPhysicsSystem.cpp

 */
 
 #include "PolyPrerequisites.h"
+#include "core/PolyEventHub.h"
 #include "core/PolyEngine.h"
 #include "core/PolyConfigurationManager.h"
 #include "game/PolyEntityManager.h"
 
 
 namespace Poly {
+	InternString PhysicsSystem::TRIGGER_EVENT("Physics/Trigger");
 	physx::PxDefaultAllocator PhysicsSystem::msDefaultAllocatorCallback;
 
 	PhysicsSystem::PhysicsSystem()
 
 		physx::PxSceneDesc sceneDesc(mSDK->getTolerancesScale());
 		sceneDesc.gravity = physx::PxVec3(0.0f, -9.8f, 0.0f);
-		//sceneDesc.simulationEventCallback = this;
+		sceneDesc.simulationEventCallback = this;
 
 		if(!sceneDesc.cpuDispatcher) {
 			const uint numThreads = 1;
 
 		gEnv.generalLog->logMessage(message, logLevel, file, line);
 	}
+
+	void PhysicsSystem::onConstraintBreak(physx::PxConstraintInfo* constraints, physx::PxU32 count) {
+	}
+
+	void PhysicsSystem::onWake(physx::PxActor** actors, physx::PxU32 count) {
+	}
+
+	void PhysicsSystem::onSleep(physx::PxActor** actors, physx::PxU32 count) {
+	}
+
+	void PhysicsSystem::onContact(const physx::PxContactPairHeader& pairHeader, const physx::PxContactPair* pairs, physx::PxU32 nbPairs) {
+	}
+
+	void PhysicsSystem::onTrigger(physx::PxTriggerPair* pairs, physx::PxU32 count) {
+		for(uint i = 0; i < count; ++i) {
+			const physx::PxTriggerPair& pair = pairs[i];
+
+			Event event;
+			event.identifier = TRIGGER_EVENT;
+
+			if(pair.triggerShape) {
+				if(pair.triggerShape->getActor().userData) {
+					PhysicsUserInfo* shapeInfo = (PhysicsUserInfo*)pair.triggerShape->getActor().userData;
+					event.arguments["TriggerEntityID"] = shapeInfo->entity.getID();
+				}
+			}
+			if(pair.otherShape) {
+				if(pair.otherShape->getActor().userData) {
+					PhysicsUserInfo* shapeInfo = (PhysicsUserInfo*)pair.otherShape->getActor().userData;
+					event.arguments["OtherEntityID"] = shapeInfo->entity.getID();
+				}
+			}
+
+
+			gEnv.globalEventHub->submit(event);
+		}
+	}
 }

PolyMain/include/physics/PolyPhysicsSystem.h

 	class _PolyExport PhysicsSystem
 	:	public ISystem,
 		public IEngineListener,
-		public physx::PxErrorCallback {
+		public physx::PxErrorCallback,
+		public physx::PxSimulationEventCallback {
 	public:
+		static InternString					TRIGGER_EVENT;
+
 											PhysicsSystem();
 		virtual								~PhysicsSystem();
 
 		// Implement PxErrorCallback.
 		virtual void						reportError(physx::PxErrorCode::Enum code, const char* message, const char* file, int line);
 
+		// Implement PxSimulationEventCallback
+		virtual void						onConstraintBreak(physx::PxConstraintInfo* constraints, physx::PxU32 count);
+		virtual void						onWake(physx::PxActor** actors, physx::PxU32 count);
+		virtual void						onSleep(physx::PxActor** actors, physx::PxU32 count);
+		virtual void						onContact(const physx::PxContactPairHeader& pairHeader, const physx::PxContactPair* pairs, physx::PxU32 nbPairs);
+		virtual void						onTrigger(physx::PxTriggerPair* pairs, physx::PxU32 count);
+
 	private:
 		static physx::PxDefaultAllocator	msDefaultAllocatorCallback;
 

PolyMain/include/util/PolyStringVariantMap.h

 		}
 		catch(const std::exception& e) {
 			SystemUtil::handleException(e);
-			return T();
+			return default;
 		}
 	}
 

PolyPython/include/PolyPythonBindings.cpp

 	bindInput();
 
 	// Runtime environment
+	Engine* engine =  gEnv.engine.get();
+	bp::scope().attr("engine") = boost::ref(engine);
+
 	ComponentManager* componentMgr =  gEnv.componentMgr.get();
 	bp::scope().attr("componentMgr") = boost::ref(componentMgr); 
 
 
 	PhysicsSystem* physics =  gEnv.physics.get();
 	bp::scope().attr("physics") = boost::ref(physics); 
+
+	EventHub* globalEventHub =  gEnv.globalEventHub.get();
+	bp::scope().attr("globalEventHub") = boost::ref(globalEventHub); 
 }
 
 void init_print(bp::object mainNamespace) {

PolyPython/include/PolyPythonCoreBindings.h

 	return StringConverter::toString(self);
 }
 
+const String& Event_getIdentifier(Event& self) {
+	return self.identifier.get();
+}
+bp::object Event_get(Event& self, const String& name, bp::object type) {
+	if(!self.arguments.contains(name)) {
+		// TODO raise AttributeError
+		return bp::object();
+	}
+
+	String typeName = bp::extract<String>(type.attr("__name__"));
+
+	if(typeName == "Entity") {
+		EntityID id = self.arguments.get<EntityID>(name);
+		return bp::object(gEnv.entityMgr->getEntity(id));
+	}
+	else {
+		POLY_LOG_WARNING("Unknown type!");
+		return bp::object();
+	}
+}
+
+struct EventHub_subscribe_Helper {
+	EventHub_subscribe_Helper(bp::object callable)
+	: _callable( callable ) {}
+
+	void operator()(const Event& evt) {
+		_callable(evt);
+	}
+
+	bp::object _callable;
+};
+void EventHub_subscribe(EventHub& self, const String& str, bp::object callback) {
+	self.subscribe(str, EventHub_subscribe_Helper(callback));
+}
+
 void bindCore() {
+	bp::class_<InternString>("InternString", bp::init<>())
+		.def(bp::init<const String&>())
+		;
+	bp::implicitly_convertible<InternString, String>();
+
+	// Logging
 	bp::def("_log_hook", &logDefault);
 	bp::def("_log_error_hook", &logError);
 
+	// Math
 	bp::class_<Radian>("Radian", bp::init<float>());
 
 	bp::class_<Ray>("Ray", bp::init<>())
 		.def(bp::init<float, float, float>())
 		.def(bp::init<float, float, float, float>())
 		;
+
+	// Events
+	bp::class_<Event>("Event")
+		.add_property("identifier",
+			bp::make_function(&Event_getIdentifier, bp::return_value_policy<bp::copy_const_reference>()))
+		
+		.def("get", &Event_get);
+
+	bp::class_<EventHub>("EventHub")
+		.def("subscribe", &EventHub_subscribe);
+
+
+	// Engine
+	bp::class_<Engine, boost::noncopyable>("Engine", bp::no_init)
+		.add_property("gameplayStepTime",
+			&Engine::getGameplayStepTime,
+			&Engine::setGameplayStepTime)
+			
+		.def("exit", &Engine::exit)
+		;
 }
 
 #endif

PolyPython/include/PolyPythonGameBindings.h

 	PyObject* mSelf;
 };
 
+bool Entity_HasComponent(Entity& self, const String& typeName) {
+	return self.hasComponent(typeName);
+}
+bool Entity_HasComponent_2(Entity& self, bp::object componentType) {
+	try {
+		String typeName = bp::extract<String>(componentType.attr("__name__"));
+
+		return Entity_HasComponent(self, typeName);
+	}
+	catch(const bp::error_already_set&) {
+		Poly::Python::_fetchError();
+		return false;
+	}
+}
+
 bp::object Entity_GetComponent(Entity& self, const String& typeName) {
 	if(!self.hasComponent(typeName))
 		return bp::object();
 		return pc->instance;
 	}
 }
-
 bp::object Entity_GetComponent_2(Entity& self, bp::object componentType) {
 	String typeName = bp::extract<String>(componentType.attr("__name__"));
 
 void parseStringValueMap(bp::dict& props, StringVariantMap& ret) {
 	bp::list keys = props.keys();
 
-	for(uint i = 0; i < bp::len(keys); ++i) {
+	for(int i = 0; i < bp::len(keys); ++i) {
 		bp::object key = keys[i];
 		bp::object val = props.get(key);
 
 }
 
 Entity EntityManager_createEntity_2(EntityManager& self, Level level, const String& typeName) {
-	return EntityManager_createEntity(self, level, typeName, bp::dict());
+	bp::dict d;
+	return EntityManager_createEntity(self, level, typeName, d);
 }
 
 void bindGame() {
 	// Entity
 	bp::class_<Entity>("Entity", bp::no_init)
 		.add_property("level", &Entity::getLevel)
+		
+		.def("hasComponent", &Entity_HasComponent)
+		.def("hasComponent", &Entity_HasComponent_2)
 
 		.def("getComponent", &Entity_GetComponent)
-		.def("getComponent", &Entity_GetComponent_2);
+		.def("getComponent", &Entity_GetComponent_2)
+		
+		.def("isValid", &Entity::isValid);
 
 	bp::class_<EntityVector>("EntityList")
 		.def("__iter__", bp::iterator<EntityVector>())
 		.def("addEntityLogic", &EntityManager::addEntityLogic)
 		
 		.def("createEntity", &EntityManager_createEntity)
-		.def("createEntity", &EntityManager_createEntity_2);
+		.def("createEntity", &EntityManager_createEntity_2)
+		
+		.def("destroyEntity", &EntityManager::destroyEntity);
 
 	// GameState
  	bp::class_<GameState, PythonGameState, GameStatePtr>("GameState")

PolyPython/include/PolyPythonPhysicsBindings.h

 		.def(bp::init<const PhysicsRaycastHit&>())
 		;
 
-	bp::class_<PhysicsSystem, boost::noncopyable>("PhysicsSystem", bp::no_init)
+	bp::object ps = bp::class_<PhysicsSystem, boost::noncopyable>("PhysicsSystem", bp::no_init)
 		.def("raycastSingle", (PhysicsRaycastHit(PhysicsSystem::*)(Level,const Ray&,float))&PhysicsSystem::raycastSingle)
 
 		.def("connectToVisualDebugger", &PhysicsSystem::connectToVisualDebugger)
 		;
+
+	ps.attr("TRIGGER_EVENT") = boost::ref(PhysicsSystem::TRIGGER_EVENT);
 }
 
 #endif
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.