#include "Object.h"

#include <Renderer/VisibleObject.h>
#include <Physics/PhysicalObject.h>

Object::Object( Renderer::ModelPtr pVisible, Renderer::ModelPtr pShadow, Physics::ModelPtr pPhysics, float Mass, bool StartSleeping )
	: m_Value( 0 )
{
	m_pVisible.reset( new Renderer::VisibleObject( pVisible, pShadow ) );
	m_pPhysics.reset( new Physics::PhysicalObject( pPhysics, Mass, StartSleeping ) );
}

Object::~Object()
{
}

void Object::Update()
{
	m_pVisible->CoordinateSpace() = m_pPhysics->GetCoordinateSpace();
}

void Object::SetPosition( const Math::Vector& P )
{
	m_pVisible->CoordinateSpace().SetPosition( P );
	m_pPhysics->SetCoordinateSpace( m_pVisible->CoordinateSpace() );
}

Math::Vector Object::GetPosition() const
{
	return m_pPhysics->GetCoordinateSpace().Position();
}

