void CPhysicsObject::SetPositionMatrix( const matrix3x4_t& matrix, bool isTeleport )
{
	if ( m_pShadow )
	{
		Vector worldPosition;
		QAngle angles;
		MatrixAngles( matrix, angles );
		MatrixGetColumn( matrix, 3, worldPosition );
		UpdateShadow( worldPosition, angles, false, 0 );
	}

	IVP_U_Quat rot;
	IVP_U_Matrix mat;

	ConvertMatrixToIVP( matrix, mat );

	rot.set_quaternion( &mat );

	if ( m_pObject->is_collision_detection_enabled() && isTeleport )
	{
		EnableCollisions( false );
		m_pObject->beam_object_to_new_position( &rot, &mat.vv, IVP_FALSE );
		EnableCollisions( true );
	}
	else
	{
		m_pObject->beam_object_to_new_position( &rot, &mat.vv, IVP_FALSE );
	}
}
Exemple #2
0
void WindowInterface::UpdateFingers( std::map<UInt32, PMVector>& a_data )
{
    //HideAllShadows();

    //sGameObjectFactory.DrawShadow(0, std::vector<ShadowData>(), PMVector());
    m_shadow->SetVisible(false);

    if (!m_object->IsVisible())
    {
        return;
    }

    CursorData data;
    UInt32 minDis = -1;

    for (std::map<UInt32, PMVector>::iterator iter = a_data.begin();
         iter != a_data.end();
         ++iter)
    {
        WindowFingerData tmp;
        tmp.oriPos = iter->second;
        tmp.distance = TransformByCoordinateSqure(iter->second);
        data.fingerData[iter->first] = tmp;

        if (tmp.distance.z < minDis)
        {
            minDis = tmp.distance.z;
            data.cursorID = iter->first;
        }
    }

    if (m_lastData.cursorID != 0)
    {
        std::map<UInt32, WindowFingerData>::iterator iter = data.fingerData.find(m_lastData.cursorID);
        if (iter != data.fingerData.end() && iter->second.distance.z < NEAR_DISTANCE_SQUARE)
        {
            data.cursorID = m_lastData.cursorID;
        }
    }

    UpdateShadow(data);
    if (m_enabled)
    {
        InterAction(data);
    }

    m_lastData.cursorID = data.cursorID;
    m_lastData.fingerData.clear();
    m_lastData.fingerData = data.fingerData;
    m_lastData.coordinate = data.coordinate;
}
void CBCGPDropDownList::Track (CPoint point, CWnd *pWndOwner)
{
	if (!Create (pWndOwner, point.x, point.y, m_Menu, FALSE, TRUE))
	{
		return;
	}

	CBCGPPopupMenuBar* pMenuBar = GetMenuBar ();
	ASSERT_VALID (pMenuBar);

	pMenuBar->m_iMinWidth = m_nMinWidth;
	pMenuBar->m_bDisableSideBarInXPMode = TRUE;

	HighlightItem (m_nCurSel);
	pMenuBar->RedrawWindow ();

	CRect rect;
	GetWindowRect (&rect);
	UpdateShadow (&rect);

	CBCGPDialog* pParentDlg = NULL;
	if (pWndOwner != NULL && pWndOwner->GetParent () != NULL)
	{
		pParentDlg = DYNAMIC_DOWNCAST (CBCGPDialog, pWndOwner->GetParent ());
		if (pParentDlg != NULL)
		{
			pParentDlg->SetActiveMenu (this);
		}
	}

	CBCGPPropertyPage* pParentPropPage = NULL;
	if (pWndOwner != NULL && pWndOwner->GetParent () != NULL)
	{
		pParentPropPage = DYNAMIC_DOWNCAST (CBCGPPropertyPage, pWndOwner->GetParent ());
		if (pParentPropPage != NULL)
		{
			pParentPropPage->SetActiveMenu (this);
		}
	}
}
void CPhysicsObject::SetPosition( const Vector &worldPosition, const QAngle &angles, bool isTeleport )
{
	IVP_U_Quat rot;
	IVP_U_Point pos;

	if ( m_pShadow )
	{
		UpdateShadow( worldPosition, angles, false, 0 );
	}
	ConvertPositionToIVP( worldPosition, pos );

	ConvertRotationToIVP( angles, rot );

	if ( m_pObject->is_collision_detection_enabled() && isTeleport )
	{
		EnableCollisions( false );
		m_pObject->beam_object_to_new_position( &rot, &pos, IVP_FALSE );
		EnableCollisions( true );
	}
	else
	{
		m_pObject->beam_object_to_new_position( &rot, &pos, IVP_FALSE );
	}
}