+int Character::getOctant(const Mf::Aabb<3>& aabb) const
+{
+ int octantNum = -1;
+
+ Mf::Plane::Halfspace halfspace;
+
+ Mf::Plane xy = aabb.getPlaneXY();
+ halfspace = xy.intersects(mSphere);
+ if (halfspace == Mf::Plane::INTERSECT)
+ {
+ halfspace = xy.intersects(mAabb);
+ }
+
+ if (halfspace == Mf::Plane::POSITIVE)
+ {
+ Mf::Plane xz = aabb.getPlaneXZ();
+ halfspace = xz.intersects(mSphere);
+ if (halfspace == Mf::Plane::INTERSECT)
+ {
+ halfspace = xz.intersects(mAabb);
+ }
+
+ if (halfspace == Mf::Plane::POSITIVE)
+ {
+ Mf::Plane yz = aabb.getPlaneYZ();
+ halfspace = yz.intersects(mSphere);
+ if (halfspace == Mf::Plane::INTERSECT)
+ {
+ halfspace = yz.intersects(mAabb);
+ }
+
+ if (halfspace == Mf::Plane::POSITIVE)
+ {
+ octantNum = 2;
+ }
+ else if (halfspace == Mf::Plane::NEGATIVE)
+ {
+ octantNum = 3;
+ }
+ }
+ else if (halfspace == Mf::Plane::NEGATIVE)
+ {
+ Mf::Plane yz = aabb.getPlaneYZ();
+ halfspace = yz.intersects(mSphere);
+ if (halfspace == Mf::Plane::INTERSECT)
+ {
+ halfspace = yz.intersects(mAabb);
+ }
+
+ if (halfspace == Mf::Plane::POSITIVE)
+ {
+ octantNum = 1;
+ }
+ else if (halfspace == Mf::Plane::NEGATIVE)
+ {
+ octantNum = 0;
+ }
+ }
+ }
+ else if (halfspace == Mf::Plane::NEGATIVE)
+ {
+ Mf::Plane xz = aabb.getPlaneXZ();
+ halfspace = xz.intersects(mSphere);
+ if (halfspace == Mf::Plane::INTERSECT)
+ {
+ halfspace = xz.intersects(mAabb);
+ }
+
+ if (halfspace == Mf::Plane::POSITIVE)
+ {
+ Mf::Plane yz = aabb.getPlaneYZ();
+ halfspace = yz.intersects(mSphere);
+ if (halfspace == Mf::Plane::INTERSECT)
+ {
+ halfspace = yz.intersects(mAabb);
+ }
+
+ if (halfspace == Mf::Plane::POSITIVE)
+ {
+ octantNum = 6;
+ }
+ else if (halfspace == Mf::Plane::NEGATIVE)
+ {
+ octantNum = 7;
+ }
+ }
+ else if (halfspace == Mf::Plane::NEGATIVE)
+ {
+ Mf::Plane yz = aabb.getPlaneYZ();
+ halfspace = yz.intersects(mSphere);
+ if (halfspace == Mf::Plane::INTERSECT)
+ {
+ halfspace = yz.intersects(mAabb);
+ }
+
+ if (halfspace == Mf::Plane::POSITIVE)
+ {
+ octantNum = 5;
+ }
+ else if (halfspace == Mf::Plane::NEGATIVE)
+ {
+ octantNum = 4;
+ }
+ }
+ }
+
+ return octantNum;
+}
+
+
+void Character::addImpulse(Mf::Vector2 impulse)
+{
+ mState.momentum += impulse;
+}
+
+void Character::addForce(Mf::Vector2 force)
+{
+ mState.force += force;
+}
+
+void Character::setPosition(Mf::Vector2 position)
+{
+ mState.position = position;