Anybody? It seems to be rotating around the players origin, relative to
where the player is looking.

 

From: Yaakov Smith [mailto:[email protected]] 
Sent: Wednesday, 18 March 2009 4:56 PM
To: 'Discussion of Half-Life Programming'
Subject: Wierd Chatbubble problem

 

I'm implementing the chatbubble in the OB SDK beta, but I ran into a slight
problem.

 

When the player is looking down, the bubble is in front of them rotated to
what I guess is the players origin.

When the player is looking up, the bubble is behind them, rotated as above.

 

How do I get it to stay above them?

 

Code:

#define CHAT_BUBBLE_MODEL "models/extras/info_chatbubble.mdl"

class CChatBubble : public CBaseAnimating

{

public:

      DECLARE_CLASS(CChatBubble, CBaseAnimating);

      CChatBubble::CChatBubble()

      {

            UseClientSideAnimation();

      }

      virtual void Spawn()

      {

            SetModel(CHAT_BUBBLE_MODEL);

            SetSolid(SOLID_NONE);

            SetMoveType(MOVETYPE_NONE);

 

            BaseClass::Spawn();

            

      }

      virtual void Precache()

      {

            PrecacheModel(CHAT_BUBBLE_MODEL);

      }

};

LINK_ENTITY_TO_CLASS(chat_bubble, CChatBubble);

PRECACHE_REGISTER(chat_bubble);

void CBasePlayer::MakeChatBubble(int iChatBubble)

{

      //Tony; incase there already is one, and another check failed.

      if ( m_lifeState != LIFE_ALIVE || GetTeamNumber() == TEAM_SPECTATOR)

      {

            KillChatBubble();

            return;

      }

 

      //Tony; don't make new ones if you already have one.

      if (m_hChatBubble.Get() != NULL)

            return;

 

      Vector fr, rt, up;

      AngleVectors(GetAbsAngles(), &fr, &rt, &up);

      Vector offset = GetAbsOrigin() + up * 92;

 

      CChatBubble *pBubble = (CChatBubble*)CBaseEntity::CreateNoSpawn(
"chat_bubble", offset, GetAbsAngles(), this );

      if (pBubble)

      {

            pBubble->Spawn();

            pBubble->FollowEntity(this, false);

 

            m_hChatBubble = pBubble; //Tony; assign it

      }

 

}

void CBasePlayer::KillChatBubble()

{

      if (m_hChatBubble.Get() != NULL)

      {

            m_hChatBubble.Get()->FollowEntity(NULL);

            m_hChatBubble.Get()->SetThink(&CBaseEntity::Remove);

            m_hChatBubble.Get()->SetNextThink(gpGlobals->curtime + 0.001);

            m_hChatBubble = NULL;

      }

}

 

void CBasePlayer::CheckChatBubble( CUserCmd *cmd )

{

      if (!cmd)

            return;

 

      if (cmd->chatenabled)

            MakeChatBubble(cmd->chatenabled);

      else

            KillChatBubble();

}

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to