Przeglądaj źródła

Added C++ components and their RTTI for Colliders

BearishSun 10 lat temu
rodzic
commit
19c72345c6
40 zmienionych plików z 1472 dodań i 40 usunięć
  1. 18 0
      BansheeCore/BansheeCore.vcxproj
  2. 60 0
      BansheeCore/BansheeCore.vcxproj.filters
  3. 4 1
      BansheeCore/Include/BsBoxCollider.h
  4. 65 0
      BansheeCore/Include/BsCBoxCollider.h
  5. 47 0
      BansheeCore/Include/BsCBoxColliderRTTI.h
  6. 79 0
      BansheeCore/Include/BsCCapsuleCollider.h
  7. 50 0
      BansheeCore/Include/BsCCapsuleColliderRTTI.h
  8. 135 0
      BansheeCore/Include/BsCCollider.h
  9. 59 0
      BansheeCore/Include/BsCColliderRTTI.h
  10. 66 0
      BansheeCore/Include/BsCPlaneCollider.h
  11. 48 0
      BansheeCore/Include/BsCPlaneColliderRTTI.h
  12. 50 0
      BansheeCore/Include/BsCRigidbody.h
  13. 46 0
      BansheeCore/Include/BsCRigidbodyRTTI.h
  14. 65 0
      BansheeCore/Include/BsCSphereCollider.h
  15. 47 0
      BansheeCore/Include/BsCSphereColliderRTTI.h
  16. 12 0
      BansheeCore/Include/BsCapsuleCollider.h
  17. 3 3
      BansheeCore/Include/BsComponent.h
  18. 23 1
      BansheeCore/Include/BsCorePrerequisites.h
  19. 2 2
      BansheeCore/Include/BsFCollider.h
  20. 2 2
      BansheeCore/Include/BsPhysics.h
  21. 3 0
      BansheeCore/Include/BsSphereCollider.h
  22. 2 2
      BansheeCore/Source/BsBoxCollider.cpp
  23. 57 0
      BansheeCore/Source/BsCBoxCollider.cpp
  24. 87 0
      BansheeCore/Source/BsCCapsuleCollider.cpp
  25. 209 0
      BansheeCore/Source/BsCCollider.cpp
  26. 56 0
      BansheeCore/Source/BsCPlaneCollider.cpp
  27. 24 0
      BansheeCore/Source/BsCRigidbody.cpp
  28. 57 0
      BansheeCore/Source/BsCSphereCollider.cpp
  29. 1 1
      BansheeCore/Source/BsSceneObject.cpp
  30. 18 18
      BansheeEngine/Include/BsCLight.h
  31. 3 2
      BansheePhysX/Include/BsFPhysXCollider.h
  32. 1 1
      BansheePhysX/Include/BsPhysX.h
  33. 4 1
      BansheePhysX/Include/BsPhysXBoxCollider.h
  34. 12 0
      BansheePhysX/Include/BsPhysXCapsuleCollider.h
  35. 3 0
      BansheePhysX/Include/BsPhysXSphereCollider.h
  36. 2 2
      BansheePhysX/Source/BsFPhysXCollider.cpp
  37. 2 2
      BansheePhysX/Source/BsPhysX.cpp
  38. 14 2
      BansheePhysX/Source/BsPhysXBoxCollider.cpp
  39. 24 0
      BansheePhysX/Source/BsPhysXCapsuleCollider.cpp
  40. 12 0
      BansheePhysX/Source/BsPhysXSphereCollider.cpp

+ 18 - 0
BansheeCore/BansheeCore.vcxproj

@@ -297,10 +297,22 @@
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
   <ItemGroup>
   <ItemGroup>
     <ClInclude Include="Include\BsBoxCollider.h" />
     <ClInclude Include="Include\BsBoxCollider.h" />
+    <ClInclude Include="Include\BsCBoxColliderRTTI.h" />
     <ClInclude Include="Include\BsCapsuleCollider.h" />
     <ClInclude Include="Include\BsCapsuleCollider.h" />
+    <ClInclude Include="Include\BsCBoxCollider.h" />
+    <ClInclude Include="Include\BsCCapsuleCollider.h" />
+    <ClInclude Include="Include\BsCCapsuleColliderRTTI.h" />
+    <ClInclude Include="Include\BsCCollider.h" />
+    <ClInclude Include="Include\BsCColliderRTTI.h" />
     <ClInclude Include="Include\BsCollider.h" />
     <ClInclude Include="Include\BsCollider.h" />
     <ClInclude Include="Include\BsCollision.h" />
     <ClInclude Include="Include\BsCollision.h" />
     <ClInclude Include="Include\BsCoreObjectCore.h" />
     <ClInclude Include="Include\BsCoreObjectCore.h" />
+    <ClInclude Include="Include\BsCPlaneCollider.h" />
+    <ClInclude Include="Include\BsCPlaneColliderRTTI.h" />
+    <ClInclude Include="Include\BsCRigidbody.h" />
+    <ClInclude Include="Include\BsCRigidbodyRTTI.h" />
+    <ClInclude Include="Include\BsCSphereCollider.h" />
+    <ClInclude Include="Include\BsCSphereColliderRTTI.h" />
     <ClInclude Include="Include\BsFCollider.h" />
     <ClInclude Include="Include\BsFCollider.h" />
     <ClInclude Include="Include\BsHString.h" />
     <ClInclude Include="Include\BsHString.h" />
     <ClInclude Include="Include\BsIconUtility.h" />
     <ClInclude Include="Include\BsIconUtility.h" />
@@ -474,9 +486,15 @@
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\BsBoxCollider.cpp" />
     <ClCompile Include="Source\BsBoxCollider.cpp" />
     <ClCompile Include="Source\BsCapsuleCollider.cpp" />
     <ClCompile Include="Source\BsCapsuleCollider.cpp" />
+    <ClCompile Include="Source\BsCBoxCollider.cpp" />
+    <ClCompile Include="Source\BsCCapsuleCollider.cpp" />
+    <ClCompile Include="Source\BsCCollider.cpp" />
     <ClCompile Include="Source\BsCollider.cpp" />
     <ClCompile Include="Source\BsCollider.cpp" />
     <ClCompile Include="Source\BsCoreObjectCore.cpp" />
     <ClCompile Include="Source\BsCoreObjectCore.cpp" />
     <ClCompile Include="Source\BsCoreThread.cpp" />
     <ClCompile Include="Source\BsCoreThread.cpp" />
+    <ClCompile Include="Source\BsCPlaneCollider.cpp" />
+    <ClCompile Include="Source\BsCRigidbody.cpp" />
+    <ClCompile Include="Source\BsCSphereCollider.cpp" />
     <ClCompile Include="Source\BsFCollider.cpp" />
     <ClCompile Include="Source\BsFCollider.cpp" />
     <ClCompile Include="Source\BsHString.cpp" />
     <ClCompile Include="Source\BsHString.cpp" />
     <ClCompile Include="Source\BsIconUtility.cpp" />
     <ClCompile Include="Source\BsIconUtility.cpp" />

+ 60 - 0
BansheeCore/BansheeCore.vcxproj.filters

@@ -99,6 +99,12 @@
     <Filter Include="Source Files\Physics">
     <Filter Include="Source Files\Physics">
       <UniqueIdentifier>{d8f2a51b-1e51-4594-a369-a496b0de73bf}</UniqueIdentifier>
       <UniqueIdentifier>{d8f2a51b-1e51-4594-a369-a496b0de73bf}</UniqueIdentifier>
     </Filter>
     </Filter>
+    <Filter Include="Header Files\Components">
+      <UniqueIdentifier>{ce72f780-9587-40e7-a178-a79d85bcf952}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="Source Files\Components">
+      <UniqueIdentifier>{a0113695-a6e4-42af-9c38-f6140bc45cc7}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClInclude Include="Include\BsCommonTypes.h">
     <ClInclude Include="Include\BsCommonTypes.h">
@@ -623,6 +629,42 @@
     <ClInclude Include="Include\BsFCollider.h">
     <ClInclude Include="Include\BsFCollider.h">
       <Filter>Header Files\Physics</Filter>
       <Filter>Header Files\Physics</Filter>
     </ClInclude>
     </ClInclude>
+    <ClInclude Include="Include\BsCBoxCollider.h">
+      <Filter>Header Files\Components</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\BsCBoxColliderRTTI.h">
+      <Filter>Header Files\RTTI</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\BsCCollider.h">
+      <Filter>Header Files\Components</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\BsCRigidbody.h">
+      <Filter>Header Files\Components</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\BsCColliderRTTI.h">
+      <Filter>Header Files\RTTI</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\BsCRigidbodyRTTI.h">
+      <Filter>Header Files\RTTI</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\BsCSphereCollider.h">
+      <Filter>Header Files\Components</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\BsCCapsuleCollider.h">
+      <Filter>Header Files\Components</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\BsCPlaneCollider.h">
+      <Filter>Header Files\Components</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\BsCSphereColliderRTTI.h">
+      <Filter>Header Files\RTTI</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\BsCPlaneColliderRTTI.h">
+      <Filter>Header Files\RTTI</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\BsCCapsuleColliderRTTI.h">
+      <Filter>Header Files\RTTI</Filter>
+    </ClInclude>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\BsCoreApplication.cpp">
     <ClCompile Include="Source\BsCoreApplication.cpp">
@@ -985,5 +1027,23 @@
     <ClCompile Include="Source\BsFCollider.cpp">
     <ClCompile Include="Source\BsFCollider.cpp">
       <Filter>Source Files\Physics</Filter>
       <Filter>Source Files\Physics</Filter>
     </ClCompile>
     </ClCompile>
+    <ClCompile Include="Source\BsCBoxCollider.cpp">
+      <Filter>Source Files\Components</Filter>
+    </ClCompile>
+    <ClCompile Include="Source\BsCCollider.cpp">
+      <Filter>Source Files\Components</Filter>
+    </ClCompile>
+    <ClCompile Include="Source\BsCRigidbody.cpp">
+      <Filter>Source Files\Components</Filter>
+    </ClCompile>
+    <ClCompile Include="Source\BsCSphereCollider.cpp">
+      <Filter>Source Files\Components</Filter>
+    </ClCompile>
+    <ClCompile Include="Source\BsCPlaneCollider.cpp">
+      <Filter>Source Files\Components</Filter>
+    </ClCompile>
+    <ClCompile Include="Source\BsCCapsuleCollider.cpp">
+      <Filter>Source Files\Components</Filter>
+    </ClCompile>
   </ItemGroup>
   </ItemGroup>
 </Project>
 </Project>

+ 4 - 1
BansheeCore/Include/BsBoxCollider.h

@@ -14,7 +14,10 @@ namespace BansheeEngine
 	public:
 	public:
 		BoxCollider();
 		BoxCollider();
 
 
-		static SPtr<BoxCollider> create(float extentX = 0.0f, float extentY = 0.0f, float extentZ = 0.0f, 
+		virtual void setExtents(const Vector3& extents) = 0;
+		virtual Vector3 getExtents() const = 0;
+
+		static SPtr<BoxCollider> create(const Vector3& extents = Vector3::ZERO, 
 			const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
 			const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
 	};
 	};
 }
 }

+ 65 - 0
BansheeCore/Include/BsCBoxCollider.h

@@ -0,0 +1,65 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsBoxCollider.h"
+#include "BsCCollider.h"
+
+namespace BansheeEngine 
+{
+	/** @addtogroup Components-Core
+	 *  @{
+	 */
+
+	/**
+	 * @copydoc	BoxCollider
+	 *
+	 * Wraps BoxCollider as a Component.
+	 */
+    class BS_CORE_EXPORT CBoxCollider : public CCollider
+    {
+    public:
+		CBoxCollider(const HSceneObject& parent, const Vector3& extents = Vector3::ONE);
+
+		/** @copydoc BoxCollider::setExtents */
+		void setExtents(const Vector3& extents);
+
+		/** @copydoc BoxCollider::getExtents */
+		Vector3 getExtents() const { return mExtents; }
+
+		/** Sets the position of the box shape, relative to the component's scene object. */
+		void setCenter(const Vector3& center);
+
+		/** Gets the position of the box shape, relative to the component's scene object. */
+		Vector3 getCenter() const { return mLocalPosition; }
+
+	    /**	Returns the box collider that this component wraps. */
+		SPtr<BoxCollider> _getInternal() const { return std::static_pointer_cast<BoxCollider>(mInternal); }
+
+		/************************************************************************/
+		/* 						COMPONENT OVERRIDES                      		*/
+		/************************************************************************/
+	protected:
+		friend class SceneObject;
+
+		/** @copydoc CCollider::createInternal */
+		SPtr<Collider> createInternal() override;
+
+    protected:
+		Vector3 mExtents;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class CBoxColliderRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		RTTITypeBase* getRTTI() const override;
+
+	protected:
+		CBoxCollider() {} // Serialization only
+     };
+
+	 /** @} */
+}

+ 47 - 0
BansheeCore/Include/BsCBoxColliderRTTI.h

@@ -0,0 +1,47 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsCBoxCollider.h"
+#include "BsGameObjectRTTI.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Core
+	 *  @{
+	 */
+
+	class BS_CORE_EXPORT CBoxColliderRTTI : public RTTIType<CBoxCollider, CCollider, CBoxColliderRTTI>
+	{
+	private:
+		BS_PLAIN_MEMBER(mExtents)
+
+	public:
+		CBoxColliderRTTI()
+		{
+			BS_ADD_PLAIN_FIELD(mExtents, 0);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "CBoxCollider";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_CBoxCollider;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return GameObjectRTTI::createGameObject<CBoxCollider>();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
+}

+ 79 - 0
BansheeCore/Include/BsCCapsuleCollider.h

@@ -0,0 +1,79 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsCapsuleCollider.h"
+#include "BsCCollider.h"
+
+namespace BansheeEngine 
+{
+	/** @addtogroup Components-Core
+	 *  @{
+	 */
+
+	/**
+	 * @copydoc	CapsuleCollider
+	 *
+	 * Wraps CapsuleCollider as a Component.
+	 */
+    class BS_CORE_EXPORT CCapsuleCollider : public CCollider
+    {
+    public:
+		CCapsuleCollider(const HSceneObject& parent, float radius = 1.0f, float halfHeight = 0.5f);
+
+		/** Sets the normal vector of the capsule. It determines how is the capsule oriented. */
+		void setNormal(const Vector3& normal);
+
+		/** Gets the normal vector of the capsule. It determines how is the capsule oriented. */
+		Vector3 getNormal() const { return mNormal; }
+
+		/** Sets the position of the capsule shape, relative to the component's scene object. */
+		void setCenter(const Vector3& center);
+
+		/** Gets the position of the capsule shape, relative to the component's scene object. */
+		Vector3 getCenter() const { return mLocalPosition; }
+
+		/** @copydoc CapsuleCollider::setHalfHeight() */
+		void setHalfHeight(float halfHeight);
+
+		/** @copydoc CapsuleCollider::getHalfHeight() */
+		float getHalfHeight() const { return mHalfHeight; }
+
+		/** @copydoc CapsuleCollider::setRadius() */
+		void setRadius(float radius);
+
+		/** @copydoc CapsuleCollider::getRadius() */
+		float getRadius() const { return mRadius; }
+
+	    /**	Returns the capsule collider that this component wraps. */
+		SPtr<CapsuleCollider> _getInternal() const { return std::static_pointer_cast<CapsuleCollider>(mInternal); }
+
+		/************************************************************************/
+		/* 						COMPONENT OVERRIDES                      		*/
+		/************************************************************************/
+	protected:
+		friend class SceneObject;
+
+		/** @copydoc CCollider::createInternal */
+		SPtr<Collider> createInternal() override;
+
+    protected:
+		Vector3 mNormal = Vector3::UNIT_Y;
+		float mRadius = 1.0f;
+		float mHalfHeight = 0.5f;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class CCapsuleColliderRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		RTTITypeBase* getRTTI() const override;
+
+	protected:
+		CCapsuleCollider() {} // Serialization only
+     };
+
+	 /** @} */
+}

+ 50 - 0
BansheeCore/Include/BsCCapsuleColliderRTTI.h

@@ -0,0 +1,50 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsCCapsuleCollider.h"
+#include "BsGameObjectRTTI.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Core
+	 *  @{
+	 */
+
+	class BS_CORE_EXPORT CCapsuleColliderRTTI : public RTTIType<CCapsuleCollider, CCollider, CCapsuleColliderRTTI>
+	{
+	private:
+		BS_PLAIN_MEMBER(mNormal)
+		BS_PLAIN_MEMBER(mRadius)
+		BS_PLAIN_MEMBER(mHalfHeight)
+	public:
+		CCapsuleColliderRTTI()
+		{
+			BS_ADD_PLAIN_FIELD(mNormal, 0);
+			BS_ADD_PLAIN_FIELD(mRadius, 1);
+			BS_ADD_PLAIN_FIELD(mHalfHeight, 2);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "CCapsuleCollider";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_CCapsuleCollider;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return GameObjectRTTI::createGameObject<CCapsuleCollider>();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
+}

+ 135 - 0
BansheeCore/Include/BsCCollider.h

@@ -0,0 +1,135 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsBoxCollider.h"
+#include "BsComponent.h"
+
+namespace BansheeEngine 
+{
+	/** @addtogroup Components-Core
+	 *  @{
+	 */
+
+	/**
+	 * @copydoc	Collider
+	 *
+	 * Wraps Collider as a Component.
+	 */
+    class BS_CORE_EXPORT CCollider : public Component
+    {
+    public:
+		CCollider(const HSceneObject& parent);
+
+		/** @copydoc Collider::setIsTrigger */
+		inline void setIsTrigger(bool value);
+
+		/** @copydoc Collider::getIsTrigger */
+		bool getIsTrigger() const { return mIsTrigger; }
+
+		/** @copydoc Collider::setMass */
+		inline void setMass(float mass);
+
+		/** @copydoc Collider::getMass */
+		float getMass() const { return mMass; }
+
+		/** @copydoc Collider::setMaterial */
+		inline void setMaterial(const HPhysicsMaterial& material);
+
+		/** @copydoc Collider::getMaterial */
+		HPhysicsMaterial getMaterial() const { return mMaterial; }
+
+		/** @copydoc Collider::setContactOffset */
+		inline void setContactOffset(float value);
+
+		/** @copydoc Collider::getContactOffset */
+		float getContactOffset() const { return mContactOffset; }
+
+		/** @copydoc Collider::setRestOffset */
+		inline void setRestOffset(float value);
+
+		/** @copydoc Collider::getRestOffset */
+		float getRestOffset() const { return mRestOffset; }
+
+		/** @copydoc Collider::setLayer */
+		inline void setLayer(UINT64 layer);
+
+		/** @copydoc Collider::getLayer */
+		UINT64 getLayer() const { return mLayer; }
+
+		/** @copydoc Collider::getRigidbody */
+		HRigidbody getRigidbody() const { return mParent; }
+
+		/** @copydoc Collider::setIsTrigger */
+		Event<void(const CollisionData&)> onCollisionBegin;
+
+		/** @copydoc Collider::setIsTrigger */
+		Event<void(const CollisionData&)> onCollisionStay;
+
+		/** @copydoc Collider::setIsTrigger */
+		Event<void(const CollisionData&)> onCollisionEnd;
+
+		/************************************************************************/
+		/* 						COMPONENT OVERRIDES                      		*/
+		/************************************************************************/
+	protected:
+		friend class SceneObject;
+
+		/** @copydoc Component::onInitialized() */
+		void onInitialized() override;
+
+		/** @copydoc Component::onDestroyed() */
+		void onDestroyed() override;
+
+		/** @copydoc Component::onDisabled() */
+		void onDisabled() override;
+
+		/** @copydoc Component::onEnabled() */
+		void onEnabled() override;
+
+		/** @copydoc Component::onTransformChanged() */
+		void onTransformChanged(TransformChangedFlags flags) override;
+
+    protected:
+		/** Creates the internal representation of the Collider for use by the component. */
+		virtual SPtr<Collider> createInternal() = 0;
+
+		/** Creates the internal representation of the Collider and restores the values saved by the Component. */
+		virtual void restoreInternal();
+
+		/** 
+		 * Updates the transform of the internal Collider representation from the transform of the component's Scene Object.
+		 */
+		void updateTransform();
+
+		/** Searches the parent scene object hierarchy to find a parent Rigidbody component. */
+		void updateParentRigidbody();
+
+		SPtr<Collider> mInternal;
+
+		UINT64 mLayer = 1;
+		float mRestOffset = 0.0f;
+		float mContactOffset = 0.0f;
+		HPhysicsMaterial mMaterial;
+		float mMass = 0.0f;
+		bool mIsTrigger = false;
+		Vector3 mLocalPosition;
+		Quaternion mLocalRotation;
+
+		HRigidbody mParent;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class CColliderRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		RTTITypeBase* getRTTI() const override;
+
+	protected:
+		CCollider() {} // Serialization only
+     };
+
+	 /** @} */
+}

+ 59 - 0
BansheeCore/Include/BsCColliderRTTI.h

@@ -0,0 +1,59 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsCCollider.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Core
+	 *  @{
+	 */
+
+	class BS_CORE_EXPORT CColliderRTTI : public RTTIType<CCollider, Component, CColliderRTTI>
+	{
+		BS_PLAIN_MEMBER(mLayer)
+		BS_PLAIN_MEMBER(mRestOffset)
+		BS_PLAIN_MEMBER(mContactOffset)
+		BS_REFL_MEMBER(mMaterial)
+		BS_PLAIN_MEMBER(mMass)
+		BS_PLAIN_MEMBER(mIsTrigger)
+		BS_PLAIN_MEMBER(mLocalPosition)
+		BS_PLAIN_MEMBER(mLocalRotation)
+
+	public:
+		CColliderRTTI()
+		{
+			BS_ADD_PLAIN_FIELD(mLayer, 0);
+			BS_ADD_PLAIN_FIELD(mRestOffset, 1);
+			BS_ADD_PLAIN_FIELD(mContactOffset, 2);
+			BS_ADD_REFL_FIELD(mMaterial, 3);
+			BS_ADD_PLAIN_FIELD(mMass, 4);
+			BS_ADD_PLAIN_FIELD(mIsTrigger, 5);
+			BS_ADD_PLAIN_FIELD(mLocalPosition, 6);
+			BS_ADD_PLAIN_FIELD(mLocalRotation, 7);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "CCollider";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_CCollider;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			BS_EXCEPT(InternalErrorException, "Cannot instantiate an abstract class.");
+		}
+	};
+
+	/** @} */
+	/** @endcond */
+}

+ 66 - 0
BansheeCore/Include/BsCPlaneCollider.h

@@ -0,0 +1,66 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsPlaneCollider.h"
+#include "BsCCollider.h"
+
+namespace BansheeEngine 
+{
+	/** @addtogroup Components-Core
+	 *  @{
+	 */
+
+	/**
+	 * @copydoc	PlaneCollider
+	 *
+	 * Wraps PlaneCollider as a Component.
+	 */
+    class BS_CORE_EXPORT CPlaneCollider : public CCollider
+    {
+    public:
+		CPlaneCollider(const HSceneObject& parent);
+
+		/** Sets the normal vector of the plane. It determines how is the plane oriented. */
+		void setNormal(const Vector3& normal);
+
+		/** Gets the normal vector of the plane. It determines how is the plane oriented. */
+		Vector3 getNormal() const { return mNormal; }
+
+		/** Sets the distance of the plane from the local origin, along its normal vector. */
+		void setDistance(float distance);
+
+		/** Gets the distance of the plane from the local origin, along its normal vector. */
+		float getDistance() const { return mDistance; }
+
+	    /**	Returns the plane collider that this component wraps. */
+		SPtr<PlaneCollider> _getInternal() const { return std::static_pointer_cast<PlaneCollider>(mInternal); }
+
+		/************************************************************************/
+		/* 						COMPONENT OVERRIDES                      		*/
+		/************************************************************************/
+	protected:
+		friend class SceneObject;
+
+		/** @copydoc CCollider::createInternal */
+		SPtr<Collider> createInternal() override;
+
+    protected:
+		Vector3 mNormal = Vector3::UNIT_Y;
+		float mDistance = 0.0f;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class CPlaneColliderRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		RTTITypeBase* getRTTI() const override;
+
+	protected:
+		CPlaneCollider() {} // Serialization only
+     };
+
+	 /** @} */
+}

+ 48 - 0
BansheeCore/Include/BsCPlaneColliderRTTI.h

@@ -0,0 +1,48 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsCPlaneCollider.h"
+#include "BsGameObjectRTTI.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Core
+	 *  @{
+	 */
+
+	class BS_CORE_EXPORT CPlaneColliderRTTI : public RTTIType<CPlaneCollider, CCollider, CPlaneColliderRTTI>
+	{
+	private:
+		BS_PLAIN_MEMBER(mNormal)
+		BS_PLAIN_MEMBER(mDistance)
+	public:
+		CPlaneColliderRTTI()
+		{
+			BS_ADD_PLAIN_FIELD(mNormal, 0);
+			BS_ADD_PLAIN_FIELD(mDistance, 1);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "CPlaneCollider";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_CPlaneCollider;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return GameObjectRTTI::createGameObject<CPlaneCollider>();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
+}

+ 50 - 0
BansheeCore/Include/BsCRigidbody.h

@@ -0,0 +1,50 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsRigidbody.h"
+#include "BsComponent.h"
+
+namespace BansheeEngine
+{
+	/** @addtogroup Components-Core
+	 *  @{
+	 */
+
+	/**
+	 * @copydoc	Rigidbody
+	 *
+	 * Wraps Rigidbody as a Component.
+	 */
+	class BS_CORE_EXPORT CRigidbody : public Component
+	{
+	public:
+		CRigidbody(const HSceneObject& parent);
+
+		// TODO
+		SPtr<Rigidbody> _getInternal() const { return mInternal; }
+		void _updateMassDistribution() { }
+	protected:
+		SPtr<Rigidbody> mInternal;
+
+		/************************************************************************/
+		/* 						COMPONENT OVERRIDES                      		*/
+		/************************************************************************/
+	protected:
+		friend class SceneObject;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class CRigidbodyRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		RTTITypeBase* getRTTI() const override;
+
+	protected:
+		CRigidbody() {} // Serialization only
+	};
+
+	/** @} */
+}

+ 46 - 0
BansheeCore/Include/BsCRigidbodyRTTI.h

@@ -0,0 +1,46 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsCRigidbody.h"
+#include "BsGameObjectRTTI.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Core
+	 *  @{
+	 */
+
+	class BS_CORE_EXPORT CRigidbodyRTTI : public RTTIType<CRigidbody, Component, CRigidbodyRTTI>
+	{
+	private:
+
+	public:
+		CRigidbodyRTTI()
+		{
+
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "CRigidbody";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_CRigidbody;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return GameObjectRTTI::createGameObject<CRigidbody>();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
+}

+ 65 - 0
BansheeCore/Include/BsCSphereCollider.h

@@ -0,0 +1,65 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsSphereCollider.h"
+#include "BsCCollider.h"
+
+namespace BansheeEngine 
+{
+	/** @addtogroup Components-Core
+	 *  @{
+	 */
+
+	/**
+	 * @copydoc	SphereCollider
+	 *
+	 * Wraps SphereCollider as a Component.
+	 */
+    class BS_CORE_EXPORT CSphereCollider : public CCollider
+    {
+    public:
+		CSphereCollider(const HSceneObject& parent, float radius = 1.0f);
+
+		/** @copydoc SphereCollider::setRadius */
+		void setRadius(float radius);
+
+		/** @copydoc SphereCollider::getRadius */
+		float getRadius() const { return mRadius; }
+
+		/** Sets the position of the sphere shape, relative to the component's scene object. */
+		void setCenter(const Vector3& center);
+
+		/** Gets the position of the sphere shape, relative to the component's scene object. */
+		Vector3 getCenter() const { return mLocalPosition; }
+
+	    /**	Returns the sphere collider that this component wraps. */
+		SPtr<SphereCollider> _getInternal() const { return std::static_pointer_cast<SphereCollider>(mInternal); }
+
+		/************************************************************************/
+		/* 						COMPONENT OVERRIDES                      		*/
+		/************************************************************************/
+	protected:
+		friend class SceneObject;
+
+		/** @copydoc CCollider::createInternal */
+		SPtr<Collider> createInternal() override;
+
+    protected:
+		float mRadius;
+
+		/************************************************************************/
+		/* 								RTTI		                     		*/
+		/************************************************************************/
+	public:
+		friend class CSphereColliderRTTI;
+		static RTTITypeBase* getRTTIStatic();
+		RTTITypeBase* getRTTI() const override;
+
+	protected:
+		CSphereCollider() {} // Serialization only
+     };
+
+	 /** @} */
+}

+ 47 - 0
BansheeCore/Include/BsCSphereColliderRTTI.h

@@ -0,0 +1,47 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsCorePrerequisites.h"
+#include "BsRTTIType.h"
+#include "BsCSphereCollider.h"
+#include "BsGameObjectRTTI.h"
+
+namespace BansheeEngine
+{
+	/** @cond RTTI */
+	/** @addtogroup RTTI-Impl-Core
+	 *  @{
+	 */
+
+	class BS_CORE_EXPORT CSphereColliderRTTI : public RTTIType<CSphereCollider, CCollider, CSphereColliderRTTI>
+	{
+	private:
+		BS_PLAIN_MEMBER(mRadius)
+
+	public:
+		CSphereColliderRTTI()
+		{
+			BS_ADD_PLAIN_FIELD(mRadius, 0);
+		}
+
+		const String& getRTTIName() override
+		{
+			static String name = "CSphereCollider";
+			return name;
+		}
+
+		UINT32 getRTTIId() override
+		{
+			return TID_CSphereCollider;
+		}
+
+		std::shared_ptr<IReflectable> newRTTIObject() override
+		{
+			return GameObjectRTTI::createGameObject<CSphereCollider>();
+		}
+	};
+
+	/** @} */
+	/** @endcond */
+}

+ 12 - 0
BansheeCore/Include/BsCapsuleCollider.h

@@ -14,6 +14,18 @@ namespace BansheeEngine
 	public:
 	public:
 		CapsuleCollider();
 		CapsuleCollider();
 
 
+		/** Sets the height of the capsule, from the origin to one of the hemispherical centers, along the normal vector. */
+		virtual void setHalfHeight(float halfHeight) = 0;
+
+		/** Gets the height of the capsule, from the origin to one of the hemispherical centers, along the normal vector. */
+		virtual float getHalfHeight() const = 0;
+
+		/** Sets the radius of the capsule. */
+		virtual void setRadius(float radius) = 0;
+
+		/** Gets the radius of the capsule. */
+		virtual float getRadius() const = 0;
+
 		static SPtr<CapsuleCollider> create(float radius = 0.0f, float halfHeight = 0.0f, 
 		static SPtr<CapsuleCollider> create(float radius = 0.0f, float halfHeight = 0.0f, 
 			const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
 			const Vector3& position = Vector3::ZERO, const Quaternion& rotation = Quaternion::IDENTITY);
 	};
 	};

+ 3 - 3
BansheeCore/Include/BsComponent.h

@@ -80,12 +80,12 @@ namespace BansheeEngine
 		/**	Called when the component is activated or created. */
 		/**	Called when the component is activated or created. */
 		virtual void onEnabled() {}
 		virtual void onEnabled() {}
 
 
+		/** Called when the component's parent scene object has changed. */
+		virtual void onTransformChanged(TransformChangedFlags flags) { }
+
 		/** Checks whether the component wants to received the specified transform changed message. */
 		/** Checks whether the component wants to received the specified transform changed message. */
 		bool supportsNotify(TransformChangedFlags flags) const { return (mNotifyFlags & flags) != 0; }
 		bool supportsNotify(TransformChangedFlags flags) const { return (mNotifyFlags & flags) != 0; }
 
 
-		/** Notifies the component that its parent scene object has changed. */
-		virtual void notifyTransformChanged(TransformChangedFlags flags) { }
-
 		/**
 		/**
 		 * Destroys this component.
 		 * Destroys this component.
 		 *
 		 *

+ 23 - 1
BansheeCore/Include/BsCorePrerequisites.h

@@ -70,6 +70,10 @@
  *  Entry point into the application.
  *  Entry point into the application.
  */
  */
 
 
+/** @defgroup Components-Core Components
+  *	Built-in components (elements that may be attached to scene objects).
+  */
+
 /** @} */
 /** @} */
 
 
 #define BS_MAX_MULTIPLE_RENDER_TARGETS 8
 #define BS_MAX_MULTIPLE_RENDER_TARGETS 8
@@ -240,6 +244,12 @@ namespace BansheeEngine
 	class SphereCollider;
 	class SphereCollider;
 	class PlaneCollider;
 	class PlaneCollider;
 	class CapsuleCollider;
 	class CapsuleCollider;
+	class CCollider;
+	class CRigidbody;
+	class CBoxCollider;
+	class CSphereCollider;
+	class CPlaneCollider;
+	class CCapsuleCollider;
 	// Asset import
 	// Asset import
 	class SpecificImporter;
 	class SpecificImporter;
 	class Importer;
 	class Importer;
@@ -411,7 +421,13 @@ namespace BansheeEngine
 		TID_StructParamData = 1089,
 		TID_StructParamData = 1089,
 		TID_MaterialParams = 1090,
 		TID_MaterialParams = 1090,
 		TID_MaterialRTTIParam = 1091,
 		TID_MaterialRTTIParam = 1091,
-		TID_PhysicsMaterial = 1092
+		TID_PhysicsMaterial = 1092,
+		TID_CCollider = 1093,
+		TID_CBoxCollider = 1094,
+		TID_CSphereCollider = 1095,
+		TID_CCapsuleCollider = 1096,
+		TID_CPlaneCollider = 1097,
+		TID_CRigidbody = 1098
 	};
 	};
 }
 }
 
 
@@ -454,6 +470,12 @@ namespace BansheeEngine
 	typedef GameObjectHandle<GameObject> HGameObject;
 	typedef GameObjectHandle<GameObject> HGameObject;
 	typedef GameObjectHandle<SceneObject> HSceneObject;
 	typedef GameObjectHandle<SceneObject> HSceneObject;
 	typedef GameObjectHandle<Component> HComponent;
 	typedef GameObjectHandle<Component> HComponent;
+	typedef GameObjectHandle<CRigidbody> HRigidbody;
+	typedef GameObjectHandle<CCollider> HCollider;
+	typedef GameObjectHandle<CBoxCollider> HBoxCollider;
+	typedef GameObjectHandle<CSphereCollider> HSphereCollider;
+	typedef GameObjectHandle<CCapsuleCollider> HCapsuleCollider;
+	typedef GameObjectHandle<CPlaneCollider> HPlaneCollider;
 
 
 	/** @} */
 	/** @} */
 }
 }

+ 2 - 2
BansheeCore/Include/BsFCollider.h

@@ -34,10 +34,10 @@ namespace BansheeEngine
 		virtual bool getIsActive() const { return mIsActive; }
 		virtual bool getIsActive() const { return mIsActive; }
 
 
 		virtual void setContactOffset(float value) = 0;
 		virtual void setContactOffset(float value) = 0;
-		virtual float getContactOffset() = 0;
+		virtual float getContactOffset() const = 0;
 
 
 		virtual void setRestOffset(float value) = 0;
 		virtual void setRestOffset(float value) = 0;
-		virtual float getRestOffset() = 0;
+		virtual float getRestOffset() const = 0;
 
 
 		virtual void setLayer(UINT64 layer);
 		virtual void setLayer(UINT64 layer);
 		virtual UINT64 getLayer() const { return mLayer; }
 		virtual UINT64 getLayer() const { return mLayer; }

+ 2 - 2
BansheeCore/Include/BsPhysics.h

@@ -20,8 +20,8 @@ namespace BansheeEngine
 		virtual SPtr<PhysicsMaterial> createMaterial(float staticFriction, float dynamicFriction, float restitution) = 0;
 		virtual SPtr<PhysicsMaterial> createMaterial(float staticFriction, float dynamicFriction, float restitution) = 0;
 		virtual SPtr<Rigidbody> createRigidbody(const HSceneObject& linkedSO) = 0;
 		virtual SPtr<Rigidbody> createRigidbody(const HSceneObject& linkedSO) = 0;
 
 
-		virtual SPtr<BoxCollider> createBoxCollider(float extentX, float extentY, float extentZ,
-			const Vector3& position, const Quaternion& rotation) = 0;
+		virtual SPtr<BoxCollider> createBoxCollider(const Vector3& extents, const Vector3& position, 
+			const Quaternion& rotation) = 0;
 		virtual SPtr<SphereCollider> createSphereCollider(float radius,
 		virtual SPtr<SphereCollider> createSphereCollider(float radius,
 			const Vector3& position, const Quaternion& rotation) = 0;
 			const Vector3& position, const Quaternion& rotation) = 0;
 		virtual SPtr<PlaneCollider> createPlaneCollider(const Vector3& position, const Quaternion& rotation) = 0;
 		virtual SPtr<PlaneCollider> createPlaneCollider(const Vector3& position, const Quaternion& rotation) = 0;

+ 3 - 0
BansheeCore/Include/BsSphereCollider.h

@@ -14,6 +14,9 @@ namespace BansheeEngine
 	public:
 	public:
 		SphereCollider();
 		SphereCollider();
 
 
+		virtual void setRadius(float radius) = 0;
+		virtual float getRadius() const = 0;
+
 		static SPtr<SphereCollider> create(float radius = 0.0f, const Vector3& position = Vector3::ZERO, 
 		static SPtr<SphereCollider> create(float radius = 0.0f, const Vector3& position = Vector3::ZERO, 
 			const Quaternion& rotation = Quaternion::IDENTITY);
 			const Quaternion& rotation = Quaternion::IDENTITY);
 	};
 	};

+ 2 - 2
BansheeCore/Source/BsBoxCollider.cpp

@@ -6,9 +6,9 @@ namespace BansheeEngine
 	BoxCollider::BoxCollider()
 	BoxCollider::BoxCollider()
 	{ }
 	{ }
 
 
-	SPtr<BoxCollider> BoxCollider::create(float extentX, float extentY, float extentZ, 
+	SPtr<BoxCollider> BoxCollider::create(const Vector3& extents,
 		const Vector3& position, const Quaternion& rotation)
 		const Vector3& position, const Quaternion& rotation)
 	{
 	{
-		return Physics::instance().createBoxCollider(extentX, extentY, extentZ, position, rotation);
+		return Physics::instance().createBoxCollider(extents, position, rotation);
 	}
 	}
 }
 }

+ 57 - 0
BansheeCore/Source/BsCBoxCollider.cpp

@@ -0,0 +1,57 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#include "BsCBoxCollider.h"
+#include "BsSceneObject.h"
+#include "BsCRigidbody.h"
+#include "BsCBoxColliderRTTI.h"
+
+namespace BansheeEngine
+{
+	CBoxCollider::CBoxCollider(const HSceneObject& parent, const Vector3& extents)
+		: CCollider(parent), mExtents(extents)
+	{
+		setName("BoxCollider");
+	}
+
+	void CBoxCollider::setExtents(const Vector3& extents)
+	{
+		if (mExtents == extents)
+			return;
+
+		mExtents = extents; 
+
+		if (mInternal != nullptr)
+		{
+			_getInternal()->setExtents(extents);
+
+			if (mParent != nullptr)
+				mParent->_updateMassDistribution();
+		}
+	}
+
+	void CBoxCollider::setCenter(const Vector3& center)
+	{
+		if (mLocalPosition == center)
+			return;
+
+		mLocalPosition = center;
+
+		if (mInternal != nullptr)
+			updateTransform();
+	}
+
+	SPtr<Collider> CBoxCollider::createInternal()
+	{
+		return BoxCollider::create(mExtents, SO()->getWorldPosition(), SO()->getWorldRotation());
+	}
+
+	RTTITypeBase* CBoxCollider::getRTTIStatic()
+	{
+		return CBoxColliderRTTI::instance();
+	}
+
+	RTTITypeBase* CBoxCollider::getRTTI() const
+	{
+		return CBoxCollider::getRTTIStatic();
+	}
+}

+ 87 - 0
BansheeCore/Source/BsCCapsuleCollider.cpp

@@ -0,0 +1,87 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#include "BsCCapsuleCollider.h"
+#include "BsSceneObject.h"
+#include "BsCRigidbody.h"
+#include "BsCCapsuleColliderRTTI.h"
+
+namespace BansheeEngine
+{
+	CCapsuleCollider::CCapsuleCollider(const HSceneObject& parent, float radius, float halfHeight)
+		: CCollider(parent), mRadius(radius), mHalfHeight(halfHeight)
+	{
+		setName("CapsuleCollider");
+	}
+
+	void CCapsuleCollider::setNormal(const Vector3& normal)
+	{
+		if (mNormal == normal)
+			return;
+
+		mNormal = normal;
+		mNormal.normalize();
+
+		mLocalRotation = Quaternion::getRotationFromTo(Vector3::UNIT_X, normal);
+
+		if (mInternal != nullptr)
+			updateTransform();
+	}
+
+	void CCapsuleCollider::setCenter(const Vector3& center)
+	{
+		if (mLocalPosition == center)
+			return;
+
+		mLocalPosition = center;
+
+		if (mInternal != nullptr)
+			updateTransform();
+	}
+
+	void CCapsuleCollider::setHalfHeight(float halfHeight)
+	{
+		if (mHalfHeight == halfHeight)
+			return;
+
+		mHalfHeight = halfHeight;
+
+		if (mInternal != nullptr)
+		{
+			_getInternal()->setHalfHeight(halfHeight);
+
+			if (mParent != nullptr)
+				mParent->_updateMassDistribution();
+		}
+	}
+
+	void CCapsuleCollider::setRadius(float radius)
+	{
+		if (mRadius == radius)
+			return;
+
+		mRadius = radius;
+
+		if (mInternal != nullptr)
+		{
+			_getInternal()->setRadius(radius);
+
+			if (mParent != nullptr)
+				mParent->_updateMassDistribution();
+		}
+	}
+
+	SPtr<Collider> CCapsuleCollider::createInternal()
+	{
+		return CapsuleCollider::create(mRadius, mHalfHeight, SO()->getWorldPosition(), SO()->getWorldRotation());
+	}
+
+	RTTITypeBase* CCapsuleCollider::getRTTIStatic()
+	{
+		return CCapsuleColliderRTTI::instance();
+	}
+
+	RTTITypeBase* CCapsuleCollider::getRTTI() const
+	{
+		return CCapsuleCollider::getRTTIStatic();
+	}
+}

+ 209 - 0
BansheeCore/Source/BsCCollider.cpp

@@ -0,0 +1,209 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#include "BsCCollider.h"
+#include "BsSceneObject.h"
+#include "BsCRigidbody.h"
+#include "BsPhysics.h"
+#include "BsCColliderRTTI.h"
+
+namespace BansheeEngine
+{
+	CCollider::CCollider(const HSceneObject& parent)
+		: Component(parent)
+	{
+		setName("Collider");
+
+		mNotifyFlags = (TransformChangedFlags)(TCF_Parent | TCF_Transform);
+	}
+
+	void CCollider::setIsTrigger(bool value)
+	{
+		if (mIsTrigger == value)
+			return;
+
+		mIsTrigger = value;
+
+		if (mInternal != nullptr)
+		{
+			mInternal->setIsTrigger(value);
+
+			updateParentRigidbody();
+			updateTransform();
+		}
+	}
+
+	void CCollider::setMass(float mass)
+	{
+		if (mMass == mass)
+			return;
+
+		mMass = mass;
+
+		if (mInternal != nullptr)
+		{
+			mInternal->setMass(mass);
+
+			if (mParent != nullptr)
+				mParent->_updateMassDistribution();
+		}
+	}
+
+	void CCollider::setMaterial(const HPhysicsMaterial& material)
+	{
+		mMaterial = material;
+
+		if (mInternal != nullptr)
+			mInternal->setMaterial(material);
+	}
+
+	void CCollider::setContactOffset(float value)
+	{
+		mContactOffset = value;
+
+		if (mInternal != nullptr)
+			mInternal->setContactOffset(value);
+	}
+
+	void CCollider::setRestOffset(float value)
+	{
+		mRestOffset = value;
+
+		if (mInternal != nullptr)
+			mInternal->setRestOffset(value);
+	}
+
+	void CCollider::setLayer(UINT64 layer)
+	{
+		mLayer = layer;
+
+		if (mInternal != nullptr)
+			mInternal->setLayer(layer);
+	}
+
+	void CCollider::onInitialized()
+	{
+
+	}
+
+	void CCollider::onDestroyed()
+	{
+		// This should release the last reference and destroy the internal collider
+		mInternal = nullptr;
+	}
+
+	void CCollider::onDisabled()
+	{
+		mParent = nullptr;
+
+		// This should release the last reference and destroy the internal collider
+		mInternal = nullptr;
+	}
+
+	void CCollider::onEnabled()
+	{
+		restoreInternal();
+	}
+
+	void CCollider::onTransformChanged(TransformChangedFlags flags)
+	{
+		if (!SO()->getActive())
+			return;
+
+		if ((flags & TCF_Parent) != 0)
+			updateParentRigidbody();
+
+		// Don't update the transform if it's due to Physics update since then we can guarantee it will remain at the same
+		// relative transform to its parent
+		if (gPhysics()._isUpdateInProgress())
+			return;
+
+		if ((flags & (TCF_Parent | TCF_Transform)) != 0)
+			updateTransform();
+	}
+
+	void CCollider::restoreInternal()
+	{
+		if(mInternal == nullptr)
+			mInternal = createInternal();
+
+		mInternal->setIsTrigger(mIsTrigger);
+		mInternal->setMass(mMass);
+		mInternal->setMaterial(mMaterial);
+		mInternal->setContactOffset(mContactOffset);
+		mInternal->setRestOffset(mRestOffset);
+		mInternal->setLayer(mLayer);
+
+		updateParentRigidbody();
+
+		if (mParent != nullptr)
+			mInternal->setRigidbody(mParent->_getInternal());
+
+		updateTransform();
+	}
+
+	void CCollider::updateParentRigidbody()
+	{
+		mParent = nullptr;
+
+		if (mIsTrigger)
+			return;
+
+		HSceneObject currentSO = SO();
+		while (currentSO != nullptr)
+		{
+			mParent = currentSO->getComponent<CRigidbody>();
+			if (mParent != nullptr)
+				return;
+
+			currentSO = currentSO->getParent();
+		}
+	}
+
+	void CCollider::updateTransform()
+	{
+		if (mParent != nullptr)
+		{
+			Vector3 parentPos = mParent->SO()->getWorldPosition();
+			Quaternion parentRot = mParent->SO()->getWorldRotation();
+
+			Vector3 myPos = SO()->getWorldPosition();
+			Quaternion myRot = SO()->getWorldRotation();
+
+			Vector3 scale = mParent->SO()->getWorldScale();
+			Vector3 invScale = scale;
+			if (invScale.x != 0) invScale.x = 1.0f / invScale.x;
+			if (invScale.y != 0) invScale.y = 1.0f / invScale.y;
+			if (invScale.z != 0) invScale.z = 1.0f / invScale.z;
+
+			Quaternion invRotation = parentRot.inverse();
+
+			Vector3 relativePos = invRotation.rotate(myPos - parentPos) *  invScale;
+			Quaternion relativeRot = invRotation * myRot;
+
+			relativePos = relativePos + myRot.rotate(mLocalPosition * scale);
+			relativeRot = relativeRot * mLocalRotation;
+
+			mInternal->setTransform(relativePos, relativeRot);
+			mParent->_updateMassDistribution();
+		}
+		else
+		{
+			Vector3 myScale = SO()->getWorldScale();
+			Quaternion myRot = SO()->getWorldRotation();
+			Vector3 myPos = SO()->getWorldPosition() + myRot.rotate(mLocalPosition * myScale);
+			myRot = myRot * mLocalRotation;
+
+			mInternal->setTransform(myPos, myRot);
+		}
+	}
+
+	RTTITypeBase* CCollider::getRTTIStatic()
+	{
+		return CColliderRTTI::instance();
+	}
+
+	RTTITypeBase* CCollider::getRTTI() const
+	{
+		return CCollider::getRTTIStatic();
+	}
+}

+ 56 - 0
BansheeCore/Source/BsCPlaneCollider.cpp

@@ -0,0 +1,56 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#include "BsCPlaneCollider.h"
+#include "BsSceneObject.h"
+#include "BsCPlaneColliderRTTI.h"
+
+namespace BansheeEngine
+{
+	CPlaneCollider::CPlaneCollider(const HSceneObject& parent)
+		: CCollider(parent)
+	{
+		setName("PlaneCollider");
+	}
+
+	void CPlaneCollider::setNormal(const Vector3& normal)
+	{
+		if (mNormal == normal)
+			return;
+
+		mNormal = normal;
+		mNormal.normalize();
+		
+		mLocalRotation = Quaternion::getRotationFromTo(Vector3::UNIT_X, normal);
+		mLocalPosition = mNormal * mDistance;
+
+		if(mInternal != nullptr)
+			updateTransform();
+	}
+
+	void CPlaneCollider::setDistance(float distance)
+	{
+		if (mDistance == distance)
+			return;
+
+		mDistance = distance; 
+		mLocalPosition = mNormal * distance;
+
+		if (mInternal != nullptr)
+			updateTransform();
+	}
+
+	SPtr<Collider> CPlaneCollider::createInternal()
+	{
+		return PlaneCollider::create(SO()->getWorldPosition(), SO()->getWorldRotation());
+	}
+
+	RTTITypeBase* CPlaneCollider::getRTTIStatic()
+	{
+		return CPlaneColliderRTTI::instance();
+	}
+
+	RTTITypeBase* CPlaneCollider::getRTTI() const
+	{
+		return CPlaneCollider::getRTTIStatic();
+	}
+}

+ 24 - 0
BansheeCore/Source/BsCRigidbody.cpp

@@ -0,0 +1,24 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#include "BsCRigidbody.h"
+#include "BsSceneObject.h"
+#include "BsCRigidbodyRTTI.h"
+
+namespace BansheeEngine
+{
+	CRigidbody::CRigidbody(const HSceneObject& parent)
+		: Component(parent)
+	{
+		setName("Rigidbody");
+	}
+
+	RTTITypeBase* CRigidbody::getRTTIStatic()
+	{
+		return CRigidbodyRTTI::instance();
+	}
+
+	RTTITypeBase* CRigidbody::getRTTI() const
+	{
+		return CRigidbody::getRTTIStatic();
+	}
+}

+ 57 - 0
BansheeCore/Source/BsCSphereCollider.cpp

@@ -0,0 +1,57 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#include "BsCSphereCollider.h"
+#include "BsSceneObject.h"
+#include "BsCRigidbody.h"
+#include "BsCSphereColliderRTTI.h"
+
+namespace BansheeEngine
+{
+	CSphereCollider::CSphereCollider(const HSceneObject& parent, float radius)
+		: CCollider(parent), mRadius(radius)
+	{
+		setName("BoxCollider");
+	}
+
+	void CSphereCollider::setRadius(float radius)
+	{
+		if (mRadius == radius)
+			return;
+
+		mRadius = radius; 
+
+		if (mInternal != nullptr)
+		{
+			_getInternal()->setRadius(radius);
+
+			if (mParent != nullptr)
+				mParent->_updateMassDistribution();
+		}
+	}
+
+	void CSphereCollider::setCenter(const Vector3& center)
+	{
+		if (mLocalPosition == center)
+			return;
+
+		mLocalPosition = center; 
+		
+		if (mInternal != nullptr)
+			updateTransform();
+	}
+
+	SPtr<Collider> CSphereCollider::createInternal()
+	{
+		return SphereCollider::create(mRadius, SO()->getWorldPosition(), SO()->getWorldRotation());
+	}
+
+	RTTITypeBase* CSphereCollider::getRTTIStatic()
+	{
+		return CSphereColliderRTTI::instance();
+	}
+
+	RTTITypeBase* CSphereCollider::getRTTI() const
+	{
+		return CSphereCollider::getRTTIStatic();
+	}
+}

+ 1 - 1
BansheeCore/Source/BsSceneObject.cpp

@@ -432,7 +432,7 @@ namespace BansheeEngine
 		for(auto& entry : mComponents)
 		for(auto& entry : mComponents)
 		{
 		{
 			if (entry->supportsNotify(flags))
 			if (entry->supportsNotify(flags))
-				entry->notifyTransformChanged(flags);
+				entry->onTransformChanged(flags);
 		}
 		}
 
 
 		for (auto& entry : mChildren)
 		for (auto& entry : mChildren)

+ 18 - 18
BansheeEngine/Include/BsCLight.h

@@ -26,61 +26,61 @@ namespace BansheeEngine
 
 
 		virtual ~CLight();
 		virtual ~CLight();
 
 
-	    /** @copydoc LightInternal::getPosition */
+	    /** @copydoc Light::getPosition */
 		Vector3 getPosition() const { return mInternal->getPosition(); }
 		Vector3 getPosition() const { return mInternal->getPosition(); }
 
 
-	    /** @copydoc LightInternal::setPosition */
+	    /** @copydoc Light::setPosition */
 		void setPosition(const Vector3& position) { mInternal->setPosition(position); }
 		void setPosition(const Vector3& position) { mInternal->setPosition(position); }
 
 
-	    /** @copydoc LightInternal::getRotation */
+	    /** @copydoc Light::getRotation */
 		Quaternion getRotation() const { return mInternal->getRotation(); }
 		Quaternion getRotation() const { return mInternal->getRotation(); }
 
 
-	    /** @copydoc LightInternal::setRotation */
+	    /** @copydoc Light::setRotation */
 		void setRotation(const Quaternion& rotation) { mInternal->setRotation(rotation); }
 		void setRotation(const Quaternion& rotation) { mInternal->setRotation(rotation); }
 
 
-	    /** @copydoc LightInternal::getType */
+	    /** @copydoc Light::getType */
 		LightType getType() const { return mInternal->getType(); }
 		LightType getType() const { return mInternal->getType(); }
 
 
-	    /** @copydoc LightInternal::setType */
+	    /** @copydoc Light::setType */
 		void setType(LightType type) { mInternal->setType(type); }
 		void setType(LightType type) { mInternal->setType(type); }
 
 
-	    /** @copydoc LightInternal::getCastsShadow */
+	    /** @copydoc Light::getCastsShadow */
 		bool getCastsShadow() const { return mInternal->getCastsShadow(); }
 		bool getCastsShadow() const { return mInternal->getCastsShadow(); }
 
 
-	    /** @copydoc LightInternal::setCastsShadow  */
+	    /** @copydoc Light::setCastsShadow  */
 		void setCastsShadow(bool castsShadow) { mInternal->setCastsShadow(castsShadow); }
 		void setCastsShadow(bool castsShadow) { mInternal->setCastsShadow(castsShadow); }
 
 
-	    /** @copydoc LightInternal::getColor */
+	    /** @copydoc Light::getColor */
 		Color getColor() const { return mInternal->getColor(); }
 		Color getColor() const { return mInternal->getColor(); }
 
 
-	    /** @copydoc LightInternal::setColor */
+	    /** @copydoc Light::setColor */
 		void setColor(const Color& color) { mInternal->setColor(color); }
 		void setColor(const Color& color) { mInternal->setColor(color); }
 
 
-	    /** @copydoc LightInternal::getRange */
+	    /** @copydoc Light::getRange */
 		float getRange() const { return mInternal->getRange(); }
 		float getRange() const { return mInternal->getRange(); }
 
 
-	    /** @copydoc LightInternal::setRange */
+	    /** @copydoc Light::setRange */
 		void setRange(float range) { mInternal->setRange(range);; }
 		void setRange(float range) { mInternal->setRange(range);; }
 
 
 	    /** @copydoc LightInternal::getIntensity */
 	    /** @copydoc LightInternal::getIntensity */
 		float getIntensity() const { return mInternal->getIntensity(); }
 		float getIntensity() const { return mInternal->getIntensity(); }
 
 
-	    /** @copydoc LightInternal::setIntensity */
+	    /** @copydoc Light::setIntensity */
 		void setIntensity(float intensity) { mInternal->setIntensity(intensity); }
 		void setIntensity(float intensity) { mInternal->setIntensity(intensity); }
 
 
-	    /** @copydoc LightInternal::getSpotAngle */
+	    /** @copydoc Light::getSpotAngle */
 		Degree getSpotAngle() const { return mInternal->getSpotAngle(); }
 		Degree getSpotAngle() const { return mInternal->getSpotAngle(); }
 
 
-	    /** @copydoc LightInternal::setSpotAngle */
+	    /** @copydoc Light::setSpotAngle */
 		void setSpotAngle(const Degree& spotAngle) { mInternal->setSpotAngle(spotAngle); }
 		void setSpotAngle(const Degree& spotAngle) { mInternal->setSpotAngle(spotAngle); }
 
 
-		/** @copydoc LightInternal::getPhysicallyBasedAttenuation  */
+		/** @copydoc Light::getPhysicallyBasedAttenuation  */
 		bool getPhysicallyBasedAttenuation() const { return mInternal->getPhysicallyBasedAttenuation(); }
 		bool getPhysicallyBasedAttenuation() const { return mInternal->getPhysicallyBasedAttenuation(); }
 
 
-		/**  @copydoc LightInternal::setPhysicallyBasedAttenuation  */
+		/**  @copydoc Light::setPhysicallyBasedAttenuation  */
 		void setPhysicallyBasedAttenuation(bool enabled) { mInternal->setPhysicallyBasedAttenuation(enabled); }
 		void setPhysicallyBasedAttenuation(bool enabled) { mInternal->setPhysicallyBasedAttenuation(enabled); }
 
 
-	    /** @copydoc LightInternal::getBounds  */
+	    /** @copydoc Light::getBounds  */
 		Sphere getBounds() const;
 		Sphere getBounds() const;
 
 
 	    /**	Returns the light that this component wraps. */
 	    /**	Returns the light that this component wraps. */

+ 3 - 2
BansheePhysX/Include/BsFPhysXCollider.h

@@ -35,7 +35,7 @@ namespace BansheeEngine
 		void setContactOffset(float value) override;
 		void setContactOffset(float value) override;
 
 
 		/** Returns shape's contact offset in meters. See setContactOffset() to learn contact offset is. */
 		/** Returns shape's contact offset in meters. See setContactOffset() to learn contact offset is. */
-		float getContactOffset() override;
+		float getContactOffset() const override;
 
 
 		/**
 		/**
 		 * Sets at what distance should two objects resting on one another come to an equilibrium. The value used in the
 		 * Sets at what distance should two objects resting on one another come to an equilibrium. The value used in the
@@ -44,13 +44,14 @@ namespace BansheeEngine
 		void setRestOffset(float value) override;
 		void setRestOffset(float value) override;
 
 
 		/** Returns shepe's rest offset in meters. See setRestOffset() to learn what contact offset is. */
 		/** Returns shepe's rest offset in meters. See setRestOffset() to learn what contact offset is. */
-		float getRestOffset() override;
+		float getRestOffset() const override;
 
 
 		void setRigidbody(const SPtr<Rigidbody>& rigidbody) override;
 		void setRigidbody(const SPtr<Rigidbody>& rigidbody) override;
 		void setMaterial(const HPhysicsMaterial& material) override;
 		void setMaterial(const HPhysicsMaterial& material) override;
 		void setIsActive(bool value) override;
 		void setIsActive(bool value) override;
 		void setLayer(UINT64 layer) override;
 		void setLayer(UINT64 layer) override;
 
 
+		physx::PxShape* _getShape() const { return mShape; }
 	protected:
 	protected:
 		physx::PxShape* mShape;
 		physx::PxShape* mShape;
 		physx::PxRigidStatic* mStaticBody;
 		physx::PxRigidStatic* mStaticBody;

+ 1 - 1
BansheePhysX/Include/BsPhysX.h

@@ -44,7 +44,7 @@ namespace BansheeEngine
 		SPtr<PhysicsMaterial> createMaterial(float staticFriction, float dynamicFriction, float restitution) override;
 		SPtr<PhysicsMaterial> createMaterial(float staticFriction, float dynamicFriction, float restitution) override;
 		SPtr<Rigidbody> createRigidbody(const HSceneObject& linkedSO) override;
 		SPtr<Rigidbody> createRigidbody(const HSceneObject& linkedSO) override;
 
 
-		SPtr<BoxCollider> createBoxCollider(float extentX, float extentY, float extentZ, const Vector3& position, 
+		SPtr<BoxCollider> createBoxCollider(const Vector3& extents, const Vector3& position,
 			const Quaternion& rotation) override;
 			const Quaternion& rotation) override;
 		SPtr<SphereCollider> createSphereCollider(float radius, const Vector3& position, const Quaternion& rotation) override;
 		SPtr<SphereCollider> createSphereCollider(float radius, const Vector3& position, const Quaternion& rotation) override;
 		SPtr<PlaneCollider> createPlaneCollider(const Vector3& position, const Quaternion& rotation) override;
 		SPtr<PlaneCollider> createPlaneCollider(const Vector3& position, const Quaternion& rotation) override;

+ 4 - 1
BansheePhysX/Include/BsPhysXBoxCollider.h

@@ -12,9 +12,12 @@ namespace BansheeEngine
 	{
 	{
 	public:
 	public:
 		PhysXBoxCollider(physx::PxPhysics* physx, const Vector3& position, const Quaternion& rotation, 
 		PhysXBoxCollider(physx::PxPhysics* physx, const Vector3& position, const Quaternion& rotation, 
-			float extentX, float extentY, float extentZ);
+			const Vector3& extents);
 		~PhysXBoxCollider();
 		~PhysXBoxCollider();
 
 
+		void setExtents(const Vector3& extents) override;
+		Vector3 getExtents() const override;
+
 	private:
 	private:
 		FPhysXCollider* getInternal() const;
 		FPhysXCollider* getInternal() const;
 	};
 	};

+ 12 - 0
BansheePhysX/Include/BsPhysXCapsuleCollider.h

@@ -15,6 +15,18 @@ namespace BansheeEngine
 			float radius, float halfHeight);
 			float radius, float halfHeight);
 		~PhysXCapsuleCollider();
 		~PhysXCapsuleCollider();
 
 
+		/** @copydoc CapsuleCollider::setHalfHeight() */
+		void setHalfHeight(float halfHeight) override;
+
+		/** @copydoc CapsuleCollider::getHalfHeight() */
+		float getHalfHeight() const override;
+
+		/** @copydoc CapsuleCollider::setRadius() */
+		void setRadius(float radius) override;
+
+		/** @copydoc CapsuleCollider::getRadius() */
+		float getRadius() const override;
+
 	private:
 	private:
 		FPhysXCollider* getInternal() const;
 		FPhysXCollider* getInternal() const;
 	};
 	};

+ 3 - 0
BansheePhysX/Include/BsPhysXSphereCollider.h

@@ -14,6 +14,9 @@ namespace BansheeEngine
 		PhysXSphereCollider(physx::PxPhysics* physx, const Vector3& position, const Quaternion& rotation, float radius);
 		PhysXSphereCollider(physx::PxPhysics* physx, const Vector3& position, const Quaternion& rotation, float radius);
 		~PhysXSphereCollider();
 		~PhysXSphereCollider();
 
 
+		void setRadius(float radius) override;
+		float getRadius() const override;
+
 	private:
 	private:
 		FPhysXCollider* getInternal() const;
 		FPhysXCollider* getInternal() const;
 	};
 	};

+ 2 - 2
BansheePhysX/Source/BsFPhysXCollider.cpp

@@ -78,7 +78,7 @@ namespace BansheeEngine
 			mRigidbody->_updateMassDistribution(); // Note: Perhaps I can just mark mass distribution as dirty and recalculate it delayed, in case a lot of colliders change
 			mRigidbody->_updateMassDistribution(); // Note: Perhaps I can just mark mass distribution as dirty and recalculate it delayed, in case a lot of colliders change
 	}
 	}
 
 
-	float FPhysXCollider::getContactOffset()
+	float FPhysXCollider::getContactOffset() const
 	{
 	{
 		return mShape->getContactOffset();
 		return mShape->getContactOffset();
 	}
 	}
@@ -88,7 +88,7 @@ namespace BansheeEngine
 		mShape->setRestOffset(value);
 		mShape->setRestOffset(value);
 	}
 	}
 
 
-	float FPhysXCollider::getRestOffset()
+	float FPhysXCollider::getRestOffset() const
 	{
 	{
 		return mShape->getRestOffset();
 		return mShape->getRestOffset();
 	}
 	}

+ 2 - 2
BansheePhysX/Source/BsPhysX.cpp

@@ -464,10 +464,10 @@ namespace BansheeEngine
 		return bs_shared_ptr_new<PhysXRigidbody>(mPhysics, mScene, linkedSO);
 		return bs_shared_ptr_new<PhysXRigidbody>(mPhysics, mScene, linkedSO);
 	}
 	}
 
 
-	SPtr<BoxCollider> PhysX::createBoxCollider(float extentX, float extentY, float extentZ, const Vector3& position, 
+	SPtr<BoxCollider> PhysX::createBoxCollider(const Vector3& extents, const Vector3& position,
 		const Quaternion& rotation)
 		const Quaternion& rotation)
 	{
 	{
-		return bs_shared_ptr_new<PhysXBoxCollider>(mPhysics, position, rotation, extentX, extentY, extentZ);
+		return bs_shared_ptr_new<PhysXBoxCollider>(mPhysics, position, rotation, extents);
 	}
 	}
 
 
 	SPtr<SphereCollider> PhysX::createSphereCollider(float radius, const Vector3& position, const Quaternion& rotation)
 	SPtr<SphereCollider> PhysX::createSphereCollider(float radius, const Vector3& position, const Quaternion& rotation)

+ 14 - 2
BansheePhysX/Source/BsPhysXBoxCollider.cpp

@@ -8,9 +8,9 @@ using namespace physx;
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
 	PhysXBoxCollider::PhysXBoxCollider(PxPhysics* physx, const Vector3& position, const Quaternion& rotation, 
 	PhysXBoxCollider::PhysXBoxCollider(PxPhysics* physx, const Vector3& position, const Quaternion& rotation, 
-		float extentX, float extentY, float extentZ)
+		const Vector3& extents)
 	{
 	{
-		PxBoxGeometry geometry(extentX, extentY, extentZ);
+		PxBoxGeometry geometry(extents.x, extents.y, extents.z);
 
 
 		PxShape* shape = physx->createShape(geometry, *gPhysX().getDefaultMaterial(), true);
 		PxShape* shape = physx->createShape(geometry, *gPhysX().getDefaultMaterial(), true);
 		shape->setLocalPose(toPxTransform(position, rotation));
 		shape->setLocalPose(toPxTransform(position, rotation));
@@ -24,6 +24,18 @@ namespace BansheeEngine
 		bs_delete(mInternal);
 		bs_delete(mInternal);
 	}
 	}
 
 
+	void PhysXBoxCollider::setExtents(const Vector3& extents)
+	{
+		PxBoxGeometry geometry(extents.x, extents.y, extents.z);
+
+		getInternal()->_getShape()->setGeometry(geometry);
+	}
+
+	Vector3 PhysXBoxCollider::getExtents() const
+	{
+		return fromPxVector(getInternal()->_getShape()->getGeometry().box().halfExtents);
+	}
+
 	FPhysXCollider* PhysXBoxCollider::getInternal() const
 	FPhysXCollider* PhysXBoxCollider::getInternal() const
 	{
 	{
 		return static_cast<FPhysXCollider*>(mInternal);
 		return static_cast<FPhysXCollider*>(mInternal);

+ 24 - 0
BansheePhysX/Source/BsPhysXCapsuleCollider.cpp

@@ -24,6 +24,30 @@ namespace BansheeEngine
 		bs_delete(mInternal);
 		bs_delete(mInternal);
 	}
 	}
 
 
+	void PhysXCapsuleCollider::setHalfHeight(float halfHeight)
+	{
+		PxCapsuleGeometry geometry(getRadius(), halfHeight);
+
+		getInternal()->_getShape()->setGeometry(geometry);
+	}
+
+	float PhysXCapsuleCollider::getHalfHeight() const
+	{
+		return getInternal()->_getShape()->getGeometry().capsule().halfHeight;
+	}
+
+	void PhysXCapsuleCollider::setRadius(float radius)
+	{
+		PxCapsuleGeometry geometry(radius, getHalfHeight());
+
+		getInternal()->_getShape()->setGeometry(geometry);
+	}
+
+	float PhysXCapsuleCollider::getRadius() const
+	{
+		return getInternal()->_getShape()->getGeometry().capsule().radius;
+	}
+
 	FPhysXCollider* PhysXCapsuleCollider::getInternal() const
 	FPhysXCollider* PhysXCapsuleCollider::getInternal() const
 	{
 	{
 		return static_cast<FPhysXCollider*>(mInternal);
 		return static_cast<FPhysXCollider*>(mInternal);

+ 12 - 0
BansheePhysX/Source/BsPhysXSphereCollider.cpp

@@ -24,6 +24,18 @@ namespace BansheeEngine
 		bs_delete(mInternal);
 		bs_delete(mInternal);
 	}
 	}
 
 
+	void PhysXSphereCollider::setRadius(float radius)
+	{
+		PxSphereGeometry geometry(radius);
+
+		getInternal()->_getShape()->setGeometry(geometry);
+	}
+
+	float PhysXSphereCollider::getRadius() const
+	{
+		return getInternal()->_getShape()->getGeometry().sphere().radius;
+	}
+
 	FPhysXCollider* PhysXSphereCollider::getInternal() const
 	FPhysXCollider* PhysXSphereCollider::getInternal() const
 	{
 	{
 		return static_cast<FPhysXCollider*>(mInternal);
 		return static_cast<FPhysXCollider*>(mInternal);