예제 #1
0
파일: Object.cpp 프로젝트: gotariz/gamejam
void Object::rotateAround(float angle, Vector2 origin)
{
    Vector2 oldPos = getAbsolutePosition();
    Vector2 newPos = getAbsolutePosition();
    newPos.rotateAround(angle,origin);

    setAbsolutePosition(newPos);

    translateChildren( newPos - oldPos );
}
예제 #2
0
void Doom3Group::translate(const Vector3& translation)
{
	m_origin += translation;

	// Only non-models should have their rendered origin different than <0,0,0>
	if (!isModel())
	{
		m_nameOrigin = m_origin;
	}

	m_renderOrigin.updatePivot();
	translateChildren(translation);
}
예제 #3
0
void Doom3Group::translate(const Vector3& translation, bool rotation) {
	
	bool freeModelRotation = GlobalRegistry().get(RKEY_FREE_MODEL_ROTATION) == "1";
	
	// greebo: If the translation does not originate from 
	// a pivoted rotation, translate the origin as well (this is a bit hacky)
	// This also applies for models, which should always have the 
	// rotation-translation applied (except for freeModelRotation set to TRUE)
	if (!rotation || (isModel() && !freeModelRotation))
	{
		m_origin = m_originKey.m_origin + translation;
	}
	
	// Only non-models should have their rendered origin different than <0,0,0>
	if (!isModel()) {
		m_nameOrigin = m_origin;
	}
	m_renderOrigin.updatePivot();
	translateChildren(translation);
}