You could just zero out the pitch component of the look vector. On Sun, Mar 22, 2009 at 10:15 AM, cheeseh-bu <chew...@gmail.com> wrote:
> changing the offset should do it as previously stated, however you want it > to be above the players head, therefore you use the Z axis not the X axis > > Vector offset = GetAbsOrigin() + Vector(0,0,92); > > this will set the origin for the bubble 92 units above the players > ('centre') of origin. Also this will not affect the position if the player > is looking up/down > > if you have any more probs can you post/upload screenshots? > > -[rcbot]Cheeseh > > On Wed, Mar 18, 2009 at 5:55 AM, Yaakov Smith <m4ngr...@gmail.com> wrote: > > > 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 > > > > > _______________________________________________ > To unsubscribe, edit your list preferences, or view the list archives, > please visit: > http://list.valvesoftware.com/mailman/listinfo/hlcoders > > _______________________________________________ To unsubscribe, edit your list preferences, or view the list archives, please visit: http://list.valvesoftware.com/mailman/listinfo/hlcoders