当前位置: 首页>>代码示例>>C++>>正文


C++ GetRotation函数代码示例

本文整理汇总了C++中GetRotation函数的典型用法代码示例。如果您正苦于以下问题:C++ GetRotation函数的具体用法?C++ GetRotation怎么用?C++ GetRotation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetRotation函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetLocation

void RoboCatServer::Update()
{
	RoboCat::Update();
	
	Vector3 oldLocation = GetLocation();
	Vector3 oldVelocity = GetVelocity();
	float oldRotation = GetRotation();

	ClientProxyPtr client = NetworkManagerServer::sInstance->GetClientProxy( GetPlayerId() );
	if( client )
	{
		MoveList& moveList = client->GetUnprocessedMoveList();
		for( const Move& unprocessedMove : moveList )
		{
			const InputState& currentState = unprocessedMove.GetInputState();
			float deltaTime = unprocessedMove.GetDeltaTime();
			ProcessInput( deltaTime, currentState );
			SimulateMovement( deltaTime );
		}

		moveList.Clear();
	}

	HandleShooting();

	if( !RoboMath::Is2DVectorEqual( oldLocation, GetLocation() ) ||
		!RoboMath::Is2DVectorEqual( oldVelocity, GetVelocity() ) ||
		oldRotation != GetRotation() )
	{
		NetworkManagerServer::sInstance->SetStateDirty( GetNetworkId(), ECRS_Pose );
	}
}
开发者ID:caldera,项目名称:MultiplayerBook,代码行数:32,代码来源:RoboCatServer.cpp

示例2: StopMoving

void CObject::Move ( const CVector& vecPosition, const CVector& vecRotation, unsigned long ulTime )
{
    // Are we already moving?
    if ( IsMoving () )
    {
        // Stop our current movement
        StopMoving ();
    }

    // If it's more than 0 milliseconds
    if ( ulTime > 0 )
    {
        // Setup our move data
        m_moveData.vecStartPosition = GetPosition ();
        m_moveData.vecStopPosition = vecPosition;
        GetRotation ( m_moveData.vecStartRotation );
        m_moveData.vecStopRotation = vecRotation;
        m_moveData.ulTime = ulTime;
        m_moveData.ulTimeStart = GetTime ();
        m_moveData.ulTimeStop = m_moveData.ulTimeStart + ulTime;
        m_moveData.bActive = true;
    }
    // If we have a time of 0, move there now
    else
    {
        SetPosition ( vecPosition );
        CVector vecTemp;
        GetRotation ( vecTemp );
        SetRotation ( vecTemp + vecRotation );
    }
}
开发者ID:50p,项目名称:multitheftauto,代码行数:31,代码来源:CObject.cpp

示例3: GetHalfExtents

LineSegment OrientedBoxShape::GetEdge(int EdgeIdx)const
{
	sf::Vector2f P1 = GetHalfExtents();
	sf::Vector2f P2 = GetHalfExtents();

	switch(EdgeIdx % 4) 
	{
	case 0:/* top edge */
		P1.x = -P1.x;
		break;
	case 1:/* right edge */
		P2.y = -P2.y;
		break;
	case 2:/* bottom edge */
		P1.y = -P1.y;
		P2 = -P2;
		break;
	default:/* left edge */
		P1 = -P1;
		P2.x = -P2.x;
		break;
	}

	P1 = MathUtils::RotateVector(P1, GetRotation());
	P1 = P1 + GetCenter();

	P2 = MathUtils::RotateVector(P1, GetRotation());
	P2 = P2 + GetCenter();

	return LineSegment(P1, P2);
}
开发者ID:Soth1985,项目名称:Survive,代码行数:31,代码来源:oriented_box_shape.cpp

示例4: Vector2

void Player::Move()
{
	//fprintf(stderr, "Move Forward\n");
	Vector2 rotation = this->GetRotation();
	Vector2 velocity = this->GetVelocity();
	rotation = Vector2(GetRotation().GetX(), GetRotation().GetY());
	velocity = velocity + rotation * 4 * pEngine->GetDeltaTime();
	SetVelocity(velocity);
}
开发者ID:hunterkill1987,项目名称:StarFighter,代码行数:9,代码来源:Player.cpp

示例5: GetPosition

void Wall::OnDestroy( bool bomb )
{
    if ( bomb )
        return;
    Vec2 d = _dir;
    d.Rotate( M_PI / M_TWO );
    Vec2 v = GetPosition() + d * M_TEN * 3;
    if ( v._x >= 0 && v._x <= Lib::WIDTH && v._y >= 0 && v._y <= Lib::HEIGHT )
        Spawn( new Square( v, GetRotation() ) );
    v = GetPosition() - d * M_TEN * 3;
    if ( v._x >= 0 && v._x <= Lib::WIDTH && v._y >= 0 && v._y <= Lib::HEIGHT )
        Spawn( new Square( v, GetRotation() ) );
}
开发者ID:grandseiken,项目名称:iispace,代码行数:13,代码来源:enemy.cpp

示例6: sin

void cEntity::TakeDamage(eDamageType a_DamageType, cEntity * a_Attacker, int a_RawDamage, int a_FinalDamage, double a_KnockbackAmount)
{
	TakeDamageInfo TDI;
	TDI.DamageType = a_DamageType;
	TDI.Attacker = a_Attacker;
	TDI.RawDamage = a_RawDamage;
	TDI.FinalDamage = a_FinalDamage;
	Vector3d Heading;
	Heading.x = sin(GetRotation());
	Heading.y = 0.4;  // TODO: adjust the amount of "up" knockback when testing
	Heading.z = cos(GetRotation());
	TDI.Knockback = Heading * a_KnockbackAmount;
	DoTakeDamage(TDI);
}
开发者ID:ravenscroftj,项目名称:MCServer,代码行数:14,代码来源:Entity.cpp

示例7: GetLocation

uint32_t TommyCoin::Write( OutgoingPacketBuffer& inPacket, uint32_t inDirtyState ) const 
{

	uint32_t writtenState = 0;

	uint32_t remainingBytes = inPacket.GetRemainingBytes();

	if( remainingBytes >= 3 * sizeof( float ) + sizeof( XMVECTOR ) )
	{
		bool poseDirty = inDirtyState & ETCRS_Pose;
		bool colorDirty = inDirtyState & ETCRS_Color;

		inPacket.Write(poseDirty);
		if (poseDirty) {
			XMVECTORF32 location; location.v = GetLocation();
			inPacket.Write(location.f[0]);
			inPacket.Write(location.f[1]);

			inPacket.Write(GetRotation());
		}

		inPacket.Write(colorDirty);
		if (colorDirty) {
			inPacket.Write(GetColor());
		}

		writtenState |= inDirtyState;
	}

	return writtenState;
}
开发者ID:jmdigiov,项目名称:ITP-470-Labs,代码行数:31,代码来源:TommyCoin.cpp

示例8: GetRotation

void MovingObstacle::Update(float dt)
{
    if(this->IsDestroyed() || m_snake == NULL)
    {
        return;
    }
    
    Actor::Update(dt);
    const float rotation = GetRotation();
    SetRotation((rotation + 190 * dt));
    
    Vector2 position = GetPosition();
    
    position += m_direction * (m_speed * dt);
    
    SetPosition(position);
    
    
    if(++m_movementCount % m_maxMovements == 0)
    {
        m_direction *= -1;
    }
    
    if(!m_snake->isInvulnerable() && m_snake->collided(this))
    {
        m_snake->collide();
    }    
}
开发者ID:d909b,项目名称:GADEL-Snake,代码行数:28,代码来源:MovingObstacle.cpp

示例9: fprintf

void Viewer3dParam::Print( FILE *fp )
{
    fprintf(fp, "%f %f %f ", eye[0], eye[1], eye[2]);
    Quaternion q = GetRotation();
    q.Print(fp);
    fprintf(fp, "\n");
}
开发者ID:Patrick6289,项目名称:navguide,代码行数:7,代码来源:glutil.cpp

示例10: GetPosition

void CClientVehicle::Serialize(CBitStream * pBitStream)
{
	// Write the vehicle position
	CVector3 vecPosition;
	GetPosition(vecPosition);
	pBitStream->Write(vecPosition);

	// Write the vehicle rotation
	CVector3 vecRotation;
	GetRotation(vecRotation);
	pBitStream->Write(vecRotation);

	// Write the vehicle move speed
	CVector3 vecMoveSpeed;
	GetMoveSpeed(vecMoveSpeed);
	pBitStream->Write(vecMoveSpeed);

	// Write the vehicle turn speed
	CVector3 vecTurnSpeed;
	GetTurnSpeed(vecTurnSpeed);
	pBitStream->Write(vecTurnSpeed);

	// Write the vehicle health
	pBitStream->Write(GetHealth());
}
开发者ID:Azon099,项目名称:networked-iv,代码行数:25,代码来源:CClientVehicle.cpp

示例11: glLoadIdentity

void CTextureNode::Render()
{
	// Check if the texture is loaded
	if ( m_GLTexture.IsLoaded() && m_Visible )
	{
		glLoadIdentity();
		glTranslatef( m_PositionAbsolute.x, m_PositionAbsolute.y, m_PositionAbsolute.z);
		glRotatef( GetRotation() ,0.0f,0.0f,1.0f);

		m_GLTexture.Bind();
		m_VBO[m_FrameNum]->BindBuffer();
		glTexCoordPointer(2,GL_FLOAT,5 * sizeof(GLfloat), ((GLubyte *) 0) );
		glVertexPointer(3,GL_FLOAT,5 * sizeof(GLfloat), ((GLubyte *) 0 + (2*sizeof(GLfloat))) );

		glEnableClientState(GL_TEXTURE_COORD_ARRAY);
		glEnableClientState(GL_VERTEX_ARRAY);

		glDrawArrays(GL_TRIANGLE_STRIP,0,4);

		glDisableClientState(GL_COLOR_ARRAY);
		glDisableClientState(GL_TEXTURE_COORD_ARRAY);
		m_VBO[m_FrameNum]->UnBindBuffer();
		m_GLTexture.UnBind();

	}
	CBaseNode::Render();
}
开发者ID:Sasker,项目名称:Endavant,代码行数:27,代码来源:CTextureNode.cpp

示例12: AString

bool cPlayer::SaveToDisk()
{
    cFile::CreateFolder(FILE_IO_PREFIX + AString("players"));

    // create the JSON data
    Json::Value JSON_PlayerPosition;
    JSON_PlayerPosition.append(Json::Value(GetPosX()));
    JSON_PlayerPosition.append(Json::Value(GetPosY()));
    JSON_PlayerPosition.append(Json::Value(GetPosZ()));

    Json::Value JSON_PlayerRotation;
    JSON_PlayerRotation.append(Json::Value(GetRotation()));
    JSON_PlayerRotation.append(Json::Value(GetPitch()));
    JSON_PlayerRotation.append(Json::Value(GetRoll()));

    Json::Value JSON_Inventory;
    m_Inventory.SaveToJson(JSON_Inventory);

    Json::Value root;
    root["position"]       = JSON_PlayerPosition;
    root["rotation"]       = JSON_PlayerRotation;
    root["inventory"]      = JSON_Inventory;
    root["health"]         = m_Health;
    root["xpTotal"]        = m_LifetimeTotalXp;
    root["xpCurrent"]      = m_CurrentXp;
    root["air"]            = m_AirLevel;
    root["food"]           = m_FoodLevel;
    root["foodSaturation"] = m_FoodSaturationLevel;
    root["foodTickTimer"]  = m_FoodTickTimer;
    root["foodExhaustion"] = m_FoodExhaustionLevel;
    root["world"] = GetWorld()->GetName();

    if (m_GameMode == GetWorld()->GetGameMode())
    {
        root["gamemode"] = (int) eGameMode_NotSet;
    }
    else
    {
        root["gamemode"] = (int) m_GameMode;
    }

    Json::StyledWriter writer;
    std::string JsonData = writer.write(root);

    AString SourceFile;
    Printf(SourceFile, "players/%s.json", m_PlayerName.c_str() );

    cFile f;
    if (!f.Open(SourceFile, cFile::fmWrite))
    {
        LOGERROR("ERROR WRITING PLAYER \"%s\" TO FILE \"%s\" - cannot open file", m_PlayerName.c_str(), SourceFile.c_str());
        return false;
    }
    if (f.Write(JsonData.c_str(), JsonData.size()) != (int)JsonData.size())
    {
        LOGERROR("ERROR WRITING PLAYER JSON TO FILE \"%s\"", SourceFile.c_str());
        return false;
    }
    return true;
}
开发者ID:Noraaron1,项目名称:MCServer,代码行数:60,代码来源:Player.cpp

示例13: GetRotation

void CVehicle::GetMatrix( CMatrix& matrix )
{
    CVector vecRotation;
    GetRotation( vecRotation );
    matrix.SetRotation( vecRotation );
    matrix.vPos = GetPosition();
}
开发者ID:vvc,项目名称:mtasa-blue,代码行数:7,代码来源:CVehicle.cpp

示例14: UpdateTargetRotation

void CVehicleEntity::SetTargetRotation(const CVector3& vecRotation, unsigned long ulDelay)
{
    // Are we spawned?
    if(IsSpawned())
	{
        // Update our target rotation
        UpdateTargetRotation();

        // Get the current time
        unsigned long ulTime = SharedUtility::GetTime();

        // Get our local rotation
        CVector3 vecLocalRotation;
        GetRotation(vecLocalRotation);

        // Set the target rotation
        m_interp.rot.vecTarget = vecRotation;

        // Get the error
        m_interp.rot.vecError = Math::GetOffsetDegrees(vecLocalRotation, vecRotation);

        // Get the interpolation interval
        m_interp.rot.ulStartTime = ulTime;
        m_interp.rot.ulFinishTime = (ulTime + ulDelay);

        // Initialize the interpolation
        m_interp.rot.fLastAlpha = 0.0f;
    }

    // Set our rotation straight
    m_vecRotation = vecRotation;
}
开发者ID:KomiHe,项目名称:IVMultiplayer,代码行数:32,代码来源:CVehicleEntity.cpp

示例15: TestResult

bool FTransform::DebugEqualMatrix(const FMatrix& Matrix) const
{
	FTransform TestResult(Matrix);
	if (!Equals(TestResult))
	{
		// see now which one isn't equal		
		if (!Scale3DEquals(TestResult.Scale3D, ScalarRegister(0.01f)))
		{
			UE_LOG(LogTransform, Log, TEXT("Matrix(S)\t%s"), *TestResult.GetScale3D().ToString());
			UE_LOG(LogTransform, Log, TEXT("VQS(S)\t%s"), *GetScale3D().ToString());
		}

		// see now which one isn't equal
		if (!RotationEquals(TestResult.Rotation))
		{
			UE_LOG(LogTransform, Log, TEXT("Matrix(R)\t%s"), *TestResult.GetRotation().ToString());
			UE_LOG(LogTransform, Log, TEXT("VQS(R)\t%s"), *GetRotation().ToString());
		}

		// see now which one isn't equal
		if (!TranslationEquals(TestResult.Translation, ScalarRegister(0.01f)))
		{
			UE_LOG(LogTransform, Log, TEXT("Matrix(T)\t%s"), *TestResult.GetTranslation().ToString());
			UE_LOG(LogTransform, Log, TEXT("VQS(T)\t%s"), *GetTranslation().ToString());
		}
		return false;
	}

	return true;
}
开发者ID:kidaa,项目名称:UnrealEngineVR,代码行数:30,代码来源:TransformVectorized.cpp


注:本文中的GetRotation函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。