本文整理汇总了C++中CVehicle::GetMoveSpeed方法的典型用法代码示例。如果您正苦于以下问题:C++ CVehicle::GetMoveSpeed方法的具体用法?C++ CVehicle::GetMoveSpeed怎么用?C++ CVehicle::GetMoveSpeed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CVehicle
的用法示例。
在下文中一共展示了CVehicle::GetMoveSpeed方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetVelocity
// getVehicleVelocity(vehicleid)
CVector3 CVehicleModuleNatives::GetVelocity(EntityId vehicleid)
{
if(g_pVehicleManager->DoesExist(vehicleid))
{
CVehicle * pVehicle = g_pVehicleManager->GetAt(vehicleid);
if(pVehicle)
{
CVector3 vecMoveSpeed;
pVehicle->GetMoveSpeed(vecMoveSpeed);
return vecMoveSpeed;
}
}
return CVector3();
}
示例2: SendInCarFullSyncData
void CLocalPlayer::SendInCarFullSyncData()
{
if(m_pPlayerPed)
{
RakNet::BitStream bsVehicleSync;
VEHICLE_SYNC_DATA vehicleSyncData;
MATRIX4X4 matVehicle;
CVehicleManager * pVehicleManager = pNetowkManager->GetVehicleManager();
CVehicle * pGameVehicle = NULL;
// write packet id
bsVehicleSync.Write((MessageID)ID_VEHICLE_SYNC);
vehicleSyncData.vehicleID = pVehicleManager->FindIDFromGtaPtr(m_pPlayerPed->GetGtaVehicle());
// make sure we have a valid vehicle
if(vehicleSyncData.vehicleID == INVALID_ENTITY_ID)
{
return;
}
// get the player keys
vehicleSyncData.wKeys = m_pPlayerPed->GetKeys();
// get the vehicle pointer
pGameVehicle = pVehicleManager->GetAt(vehicleSyncData.vehicleID);
// make sure the vehicle pointer is valid
if(!pGameVehicle)
{
return;
}
// get the vehicle matrix
pGameVehicle->GetMatrix(&matVehicle);
// copy the roll and direction vectors
memcpy(&vehicleSyncData.vecRoll, &matVehicle.vLookRight, sizeof(Vector3));
memcpy(&vehicleSyncData.vecDirection, &matVehicle.vLookUp, sizeof(Vector3));
// pack the roll and direction vectors
//CompressVector1(&matVehicle.vLookRight, &vehicleSyncData.cvecRoll);
//CompressVector1(&matVehicle.vLookUp, &vehicleSyncData.cvecDirection);
// copy the vehicle position
memcpy(&vehicleSyncData.vecPos, &matVehicle.vPos, sizeof(Vector3));
// get the vehicle move speed
pGameVehicle->GetMoveSpeed(&vehicleSyncData.vecMoveSpeed);
// get the vehicle turn speed
pGameVehicle->GetTurnSpeed(&vehicleSyncData.vecTurnSpeed);
// pack the vehicle health
vehicleSyncData.byteVehicleHealth = PACK_VEHICLE_HEALTH(pGameVehicle->GetHealth());
// get the player health (casted to a byte to save space)
vehicleSyncData.bytePlayerHealth = (BYTE)m_pPlayerPed->GetHealth();
// get the player armour (casted to a byte to save space)
vehicleSyncData.bytePlayerArmour = (BYTE)m_pPlayerPed->GetArmour();
// write vehicle sync struct to bit stream
bsVehicleSync.Write((char *)&vehicleSyncData, sizeof(VEHICLE_SYNC_DATA));
// send sync data
pNetowkManager->GetRakPeer()->Send(&bsVehicleSync,HIGH_PRIORITY,UNRELIABLE_SEQUENCED,0,UNASSIGNED_SYSTEM_ADDRESS,TRUE);
}
}