本文整理汇总了C++中IPlayer::GetPlayer方法的典型用法代码示例。如果您正苦于以下问题:C++ IPlayer::GetPlayer方法的具体用法?C++ IPlayer::GetPlayer怎么用?C++ IPlayer::GetPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPlayer
的用法示例。
在下文中一共展示了IPlayer::GetPlayer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TeleportTo
void TeleportTo(Vector3* position)
{
IPlayer* me = GetMe();
if (!me) return;
Player* playerMe = me->GetPlayer();
if (!playerMe) return;
IActor* actorMe = me->vfptr->GetActorInterface(me);
if (!actorMe) return;
IUE4Actor* ue4actor = playerMe->baseclass_0.m_target;
if (!ue4actor) return;
World* GameWorld = GetWorldObject();
if (!GameWorld) return;
//auto const logMsg = boost::str(boost::format("TeleportTo(%.2f,%.2f,%.2f)")
// % position->x % position->y % position->z);
//Chat(logMsg);
Rotation rot{ 0, 0, 0 };
ue4actor->vfptr->GetRotation(ue4actor, &rot);
GameWorld->vfptr->SendRespawnEvent(GameWorld, me->GetPlayer(), position, &rot);
ue4actor->vfptr->LocalRespawn(ue4actor, position, &rot);
}
示例2: TeleportForward
void TeleportForward(float distance)
{
IPlayer* me = GetMe();
if (!me) return;
Player* playerMe = me->GetPlayer();
if (!playerMe) return;
IActor* actorMe = me->vfptr->GetActorInterface(me);
if (!actorMe) return;
IUE4Actor* ue4actor = playerMe->baseclass_0.m_target;
if (!ue4actor) return;
Vector3 position;
Rotation rotation;
ue4actor->vfptr->GetPosition(ue4actor, &position);
ue4actor->vfptr->GetRotation(ue4actor, &rotation);
// Their angles go from [0, 180) and [-0, -180), convert to [0, 360).
float facing = rotation.yaw;
if (facing < 0.0f)
{
facing += 360.0f;
}
facing = facing * static_cast<float>(M_PI) / 180.0f;
float const x = std::cos(facing);
float const y = std::sin(facing);
// TODO: z
position.x += distance * x;
position.y += distance * y;
TeleportTo(&position);
}