void BoneAttachedEntity_cl::Update() { if (!m_bIsAttached) return; hkvQuat newRotation; hkvVec3 newTranslation, tempTranslation; //// calculate new transformation hkvVec3 boneWorldSpaceTranslation; hkvQuat boneWorldSpaceRotation; m_pAnchorEntity->GetBoneCurrentWorldSpaceTransformation(m_iAnchorBoneIndex, boneWorldSpaceTranslation, boneWorldSpaceRotation); //don't update if nothing changed //if(boneWorldSpaceTranslation == m_vBoneWorldSpaceTranslation && boneWorldSpaceRotation == m_qBoneWorldSpaceRotation) //{ // return; //} else //{ // m_vBoneWorldSpaceTranslation = boneWorldSpaceTranslation; // m_qBoneWorldSpaceRotation = boneWorldSpaceRotation; //} //calculate new position and orientation newRotation = m_LocalRotation.multiplyReverse (boneWorldSpaceRotation); newTranslation = boneWorldSpaceRotation.transform(m_LocalTranslation); newTranslation += boneWorldSpaceTranslation; // set new transformation SetPosition(newTranslation); hkvMat3 m = newRotation.getAsMat3 (); SetRotationMatrix(m); }
void CTransformationMatrix2::SetFromComponents(const CRotationMatrix2& c_rotation, const CVector2& c_translation) { SetRotationMatrix(c_rotation); SetTranslationVector(c_translation); m_pfValues[6] = 0.0f; m_pfValues[7] = 0.0f; m_pfValues[8] = 1.0f; }
void OpenGLObject::SetAttitude( double angle, const Vector3 axis ) { Matrix3x3 m; SetRotationMatrix( m, ToRadians( angle ), axis ); SetAttitude( m ); }
void Viewpoint::SetOrientation( double angle, Vector3 axis ) { Matrix3x3 m; SetRotationMatrix( m, ToRadians( angle ), axis ); SetOrientation( m ); }
void BonusTask::DrawTask() { SetRotationMatrix(); glBindVertexArray(m_uiVertexArrayHandle); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, m_uiElementsBuffer); glDrawElements(GL_QUAD_STRIP, 10, GL_UNSIGNED_SHORT, (void*) 0); // base glDrawElements(GL_TRIANGLE_STRIP, 8, GL_UNSIGNED_SHORT, (void*) (10 * sizeof(GLushort))); // roof glDrawElements(GL_TRIANGLE_STRIP, 10, GL_UNSIGNED_SHORT, (void*) (18 * sizeof(GLushort))); // chimney glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); glBindVertexArray(0); }
void RPG_Projectile::Fire(hkvVec3 position, hkvVec3 direction, float speed) { VASSERT(m_characterOwner); m_spawnTime = Vision::GetTimer()->GetTime(); m_currentPosition = position; SetPosition(position); VASSERT_MSG(direction.isNormalized(), "Please normalize your projectile fire direction."); m_direction = direction; m_speed = speed; hkvMat3 vRotation; vRotation.setLookInDirectionMatrix(m_direction); SetRotationMatrix(vRotation); CreateShapePhantom(); // create inflight effect CreateEffect(PFX_Inflight); }
void AttachedDagger_cl::Update() { hkvQuat newRotation; hkvVec3 newTranslation, tempTranslation; if (!m_bIsAttached) return; //// calculate new transformation hkvVec3 boneWorldSpaceTranslation; hkvQuat boneWorldSpaceRotation; m_pAnchorEntity->GetBoneCurrentWorldSpaceTransformation(m_iAnchorBoneIndex, boneWorldSpaceTranslation, boneWorldSpaceRotation); //m_pAnchorEntity->GetAnimConfig()->GetBoneCurrentWorldSpaceTransformation(m_pAnchorEntity, m_iAnchorBoneIndex, boneWorldSpaceTranslation, boneWorldSpaceRotation); //// calculate new position and orientation // add bone transformation newRotation = m_LocalRotation.multiplyReverse (boneWorldSpaceRotation); newTranslation = boneWorldSpaceRotation.transform (m_LocalTranslation); newTranslation += boneWorldSpaceTranslation; // set new transformation SetPosition(newTranslation); hkvMat3 m = newRotation.getAsMat3 (); SetRotationMatrix(m); }