本文整理汇总了C++中GetRotation函数的典型用法代码示例。如果您正苦于以下问题:C++ GetRotation函数的具体用法?C++ GetRotation怎么用?C++ GetRotation使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetRotation函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: Advance
void CWall::Advance(float dt)
{
(void)dt;
m_visual.SetPosition(GetPosition());
m_visual.SetRotation(GetRotation());
}
开发者ID:7kia,项目名称:CG,代码行数:7,代码来源:Wall.cpp
示例17: Rotate
void wxTransformMatrix::SetRotation(double rotation)
{
double x=GetValue(2,0);
double y=GetValue(2,1);
Rotate(-GetRotation(), x, y);
Rotate(rotation, x, y);
}
开发者ID:ACanadianKernel,项目名称:pcsx2,代码行数:7,代码来源:matrix.cpp
示例18: GetTransformationMatrix
//! called during the update of the entity
void LaserSwiper::Update()
{
super::Update();
if(m_HitPoints < 0)
{
return;
}
LaserSwiperSettings* pSettings = static_cast<LaserSwiperSettings*>(m_Settings.Get());
// aim
Player* pPlayer = Player::Instance();
Vector3 vPosition = GetTransformationMatrix().GetTranslation();
Vector3 vPlayerMeshPos = pPlayer->GetMeshEntity()->GetTransformationMatrix().GetTranslation();
Vector3 vToPlayer = (vPlayerMeshPos-vPosition).Normalize();
f32 fDestAngle = Math::ATan2(vToPlayer.X, -vToPlayer.Y)*Math::RadToDegFactor;
f32 fRotation = Math::Damp(GetRotation().Z, 180.0f-fDestAngle, g_fDeltaTime, pSettings->m_fAimDuration);
m_fCurrentAngle = Math::Damp(m_fCurrentAngle, fDestAngle, g_fDeltaTime, pSettings->m_fAimDuration);
SetRotation(Vector3::Create(0.0f, 0.0f, fRotation));
f32 fDistSquared = (vPosition-vPlayerMeshPos).GetLengthSquared();
if(fDistSquared < m_fLaserLengthSquared)
{
// swipe
Vector3 vPosition = GetTransformationMatrix().GetTranslation();
Vector3 vOffset = Vector3::Create(0.0f, -pSettings->m_fLaserOffset, 0.0f);
Vector3 vRotatedOffset = Quaternion(Vector3::Create(0.0f, 0.0f, 1.0f), m_fCurrentAngle*Math::DegToRadFactor).Rotate(vOffset);
if(!m_pLaser || m_pLaser->fLife < 0.0f)
{
// shoot
Laser::Params params;
params.vStart = vPosition + vRotatedOffset;
params.vDir = vRotatedOffset.Normalize();
params.fSpeed = pSettings->m_fLaserSpeed;
params.fMaxLength = pSettings->m_fLaserLength;
params.fLife = 999.0f;
params.bStatic = true;
params.fThickness = pSettings->m_fLaserThickness;
m_pLaser = SFXManager::Instance()->GetEnemyLaserManager()->AddLaser(params);
}
else
{
// update laser
m_pLaser->vStart = vPosition + vRotatedOffset;
m_pLaser->vDir = vRotatedOffset.Normalize();
}
}
else
{
Translate(Vector3::Create(0.0f, -pSettings->m_fSpeed*g_fDeltaTime, 0.0f));
if(m_pLaser)
{
m_pLaser->fLife = 0.0f;
m_pLaser = NULL;
}
}
}
开发者ID:aminere,项目名称:VLADHeavyStrikePublic,代码行数:61,代码来源:LaserSwiper.cpp
示例19: GetRotation
void CPed::GetMatrix( CMatrix& matrix )
{
CVector vecRotation;
vecRotation.fZ = GetRotation();
matrix.SetRotation( vecRotation );
matrix.vPos = GetPosition();
}
开发者ID:vvc,项目名称:mtasa-blue,代码行数:7,代码来源:CPed.cpp
示例20: GetPosition
int CasteroidIGC::Export(void* data) const
{
if (data)
{
DataAsteroidIGC* dataAsteroid = (DataAsteroidIGC*)data;
dataAsteroid->asteroidDef = m_asteroidDef;
dataAsteroid->position = GetPosition();
{
const Orientation& o = GetOrientation();
dataAsteroid->forward = o.GetForward();
dataAsteroid->up = o.GetUp();
}
dataAsteroid->rotation = GetRotation();
assert (GetCluster());
dataAsteroid->clusterID = GetCluster()->GetObjectID();
dataAsteroid->signature = GetSignature();
dataAsteroid->fraction = m_fraction;
const char* pszName = GetName();
if (*pszName == '\0')
memcpy(dataAsteroid->name, GetName(), sizeof(dataAsteroid->name));
else
UTL::putName(dataAsteroid->name, GetName());
}
return sizeof(DataAsteroidIGC);
}
开发者ID:ImagoTrigger,项目名称:FreeAllegiance,代码行数:30,代码来源:asteroidigc.cpp
注:本文中的GetRotation函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论