本文整理汇总了C++中Transform::AxisRotate方法的典型用法代码示例。如果您正苦于以下问题:C++ Transform::AxisRotate方法的具体用法?C++ Transform::AxisRotate怎么用?C++ Transform::AxisRotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Transform
的用法示例。
在下文中一共展示了Transform::AxisRotate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TickLocal
void Player::TickLocal( float dt )
{
float3 oldposition = transform.GetTranslation();
// Get position update from physics engine
float3 p = m_charController->GetPosition();
//m_collider->transform.SetTranslation( p );
transform.SetTranslation( p + float3( 0, COLLIDER_OFFSET, 0 ) );
// Read mouse input and rotate
if( Input::instance->ry != 0 || Input::instance->rx != 0 )
{
m_pitch += ( Input::instance->rx * ( PI / 180.f ) * dt * 0.1f );
m_yaw += Input::instance->ry * dt * 0.1f;
Transform transf;
transf.Rotate( float3( -GetRotYaw(), 0, 0.f ) );
transf.AxisRotate( float3( 0, 1, 0 ), GetRotation() );
// transf.SetTranslation( p );
Camera::s_mainCamera->transform = transf;
//Camera::s_mainCamera->transform.Rotate( float3( -dt * Input::instance->ry * 0.1f, 0, 0 ) );
//Camera::s_mainCamera->transform.AxisRotate( float3( 0, 1, 0 ), Input::instance->rx * ( PI / 180 ) * dt * 0.1f );
}
transform.Rotate( float3( 0, -m_pitch * ( 180 / PI ), 0 ) );
m_rotation += m_pitch;
m_rotYaw += m_yaw;
m_acceleration = float3( 0, 0, 0 );
ProcessInput( dt );
matrix rotation;
rotation.RotateY( -m_rotation * ( 180 / PI ) );
m_acceleration = rotation.Transform( m_acceleration );
m_charController->Move( m_acceleration );
m_charController->Tick( dt );
if( Network::Get()->IsConnected() )
{
float3 newPos = float3::Lerp(
transform.GetTranslation() + ( m_netTransform.GetTranslation() - transform.GetTranslation() ) * 0.1f
, m_netTransform.GetTranslation(), dt * 0.05f );
m_charController->MoveTo( newPos - float3( 0, COLLIDER_OFFSET, 0 ) );
}
float3 vel = transform.GetTranslation() - oldposition;
if( transform.GetTranslation().y < -7.f && m_state == ALIVE ) Suicide();
// Set camera //
Camera::s_mainCamera->transform.SetTranslation( transform.GetTranslation() + float3( 0.f, 2.f, 0.f ) );
}