本文整理汇总了C++中Mat4x4::GetUp方法的典型用法代码示例。如果您正苦于以下问题:C++ Mat4x4::GetUp方法的具体用法?C++ Mat4x4::GetUp怎么用?C++ Mat4x4::GetUp使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mat4x4
的用法示例。
在下文中一共展示了Mat4x4::GetUp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VUpdate
void PhysicsComponent::VUpdate(int deltaMs)
{
// get the transform component
shared_ptr<TransformComponent> pTransformComponent = MakeStrongPtr(m_pOwner->GetComponent<TransformComponent>(TransformComponent::g_Name));
if (!pTransformComponent)
{
GCC_ERROR("No transform component!");
return;
}
// get the direction the object is facing
Mat4x4 transform = pTransformComponent->GetTransform();
if (m_acceleration != 0)
{
// calculate the acceleration this frame
float accelerationToApplyThisFrame = m_acceleration / 1000.f * (float)deltaMs;
// Get the current velocity vector and convert to a scalar. The velocity vector is a combination of
// the direction this actor is going in and the speed of the actor. The scalar is just the speed
// component.
Vec3 velocity(m_pGamePhysics->VGetVelocity(m_pOwner->GetId()));
float velocityScalar = velocity.Length();
Vec3 direction(transform.GetDirection());
m_pGamePhysics->VApplyForce(direction, accelerationToApplyThisFrame, m_pOwner->GetId());
// logging
// [rez] Comment this back in if you want to debug the physics thrust & rotation stuff. It spams quite
// a bit of info the output window so I'm commenting it out for now.
/*
GCC_LOG("Actor", "Acceleration: " + ToStr(accelerationToApplyThisFrame) + "; velocityScalar: " + ToStr(velocityScalar) + \
"; direction: " + ToStr(direction) + "; direction.Length(): " + ToStr(direction.Length()) + \
"; velocity: " + ToStr(velocity) + "; velocity.Length(): " + ToStr(velocity.Length()));
*/
}
if (m_angularAcceleration != 0)
{
// calculate the acceleration this frame
float angularAccelerationToApplyThisFrame = m_angularAcceleration / 1000.f * (float)deltaMs;
m_pGamePhysics->VApplyTorque(transform.GetUp(), angularAccelerationToApplyThisFrame, m_pOwner->GetId());
// logging
// [rez] Comment this back in if you want to debug the physics thrust & rotation stuff. It spams quite
// a bit of info the output window so I'm commenting it out for now.
//GCC_LOG("Actor", "Angular Acceleration: " + ToStr(angularAccelerationToApplyThisFrame) );
}
}