コード例 #1
0
// virtual 
bool nuiPadGestureRecognizer::MouseMoved(nuiSize X, nuiSize Y)
{
  bool res = nuiGestureRecognizer::MouseMoved(X, Y);
  
  if (!mClicked)
    return false;
  
	double diffx = mLastX - X;
	double diffy = mLastY - Y;
  double currentTime = nglTime();
  nuiVector v(diffx, diffy, 0);

  double l = v.Length();
  if (l > PAD_ATTENUATOR_THRESHOLD)
    mForce *= 1.0 / l;
  
  mForce += v;

  double length = mForce.Length();

  nuiVector n = mForce;
  //printf("NEW norm: %f - angle: %f\n", GetStrength(), GetDegrees());
 
  mLastX = X;
  mLastY = Y;
  

  UpdateDirection();
  
  return false;
}
コード例 #2
0
void nuiPadGestureRecognizer::UpdateForces(const nuiEvent& rEvent)
{
  mForce *= mFriction;
  //printf("UPD norm: %f - angle: %f\n", GetStrength(), GetDegrees());
  
  UpdateDirection();
}
コード例 #3
0
void CPlayerBase::updateFalling()
{
	UpdateDirection();
	UpdateMovDirection();

	if (cc->OnGround()) {
		jspeed = 0.0f;
		ChangeState("idle");
		ChangeCommonState("idle");
	}
}
コード例 #4
0
void CPlayerBase::Jumping()
{
	PROFILE_FUNCTION("jumping base");
	UpdateDirection();
	UpdateMovDirection();

	if (cc->GetYAxisSpeed() < 0) {
		ChangeState("falling");
		ChangeCommonState("falling");
	}
}
コード例 #5
0
ファイル: krlremotecharacter.cpp プロジェクト: 1suming/pap2
int KRLRemoteCharacter::UpdateDisplayData(BOOL bForceUpdate)
{
    int nRetCode = false;
    int nResult = false;
    HRESULT hr = E_FAIL;
    KRLCharacterEquipResource EquipResource;
    KRLCharacterDisplayData RLCharacterDisplayData;

    nRetCode = m_RLCharacter.PauseAnimationStatus(&RLCharacterDisplayData);
    KGLOG_CHECK_ERROR(nRetCode);

    nRetCode = m_FrameData.UpdateCurrentRepresentFrameData(true, m_FrameData.GetCurrentPosition());
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = GetCharacterModel(&g_pRL->m_ResourceLimit, 
        m_FrameData.m_pCharacter, &EquipResource);
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = m_RLCharacter.UpdateModel(EquipResource, bForceUpdate);
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = m_FrameData.Interpolate(m_RLCharacter.m_RenderData.IsVisible(), true);
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = m_RLCharacter.UpdateVehicle(m_FrameData.m_Current.nVehicleTrack, TRUE);
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = UpdatePosition(TRUE);
    KGLOG_PROCESS_ERROR(nRetCode);
    
	nRetCode = UpdateYaw(NULL);
	KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = UpdateDirection(bForceUpdate);
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = m_RLCharacter.UpdateBalloon();
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = m_RLCharacter.UpdateTitleMark();
    KGLOG_PROCESS_ERROR(nRetCode);

    UpdateSkillBuff();

    UpdateLifeState(TRUE);

    nRetCode = m_RLCharacter.ResumeAnimationStatus(&RLCharacterDisplayData);
    KGLOG_CHECK_ERROR(nRetCode);

    nResult = true;
Exit0:
    return nResult;
}
コード例 #6
0
void CPlayerBase::Idle()
{
	PROFILE_FUNCTION("idle base");
	ChangeCommonState("idle");
	if (!checkDead()) {
		UpdateDirection();
		UpdateJumpState();
		if (UpdateMovDirection() && (state == "moving" || state == "idle")) {
			ChangeCommonState("moving");
			ChangeState("moving");
		}
	}
}
コード例 #7
0
ファイル: camera.cpp プロジェクト: rokn/GEAR
	Camera::Camera(GLfloat aspectRatio, glm::vec3 position, GLfloat moveSpeed, GLfloat fov, glm::vec3 worldUp, GLfloat pitch, GLfloat yaw, GLfloat nearClip, GLfloat farClip)
	{
		_aspectRatio = aspectRatio;
		_position = position;
		_moveSpeed = moveSpeed;
		_fov = fov;
		_pitch = pitch;
		_yaw = yaw;
		_worldUpDirection = worldUp;
		_nearClip = nearClip;
		_farClip = farClip;
		UpdateDirection();
	}
コード例 #8
0
ファイル: krllocalcharacter.cpp プロジェクト: viticm/pap2
int KRLLocalCharacter::UpdateDisplayData(BOOL bForceUpdate)
{
    int nRetCode = false;
    int nResult = false;
    HRESULT hr = E_FAIL;
    KRLCharacterEquipResource EquipResource;
    KRLCharacterDisplayData RLCharacterDisplayData;

    nRetCode = m_RLCharacter.PauseAnimationStatus(&RLCharacterDisplayData);
    KGLOG_CHECK_ERROR(nRetCode);

    nRetCode = m_RLCharacter.m_FrameData.UpdateCurrentRepresentFrameData(true);
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = m_RLCharacter.m_FrameData.Interpolate(m_RLCharacter.m_RenderData.IsVisible(), true);
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = UpdatePosition();
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = UpdateDirection();
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = GetCharacterModel(m_RLCharacter.m_FrameData.m_pCharacter, &EquipResource);
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = m_RLCharacter.UpdateModel(EquipResource, bForceUpdate);
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = m_RLCharacter.UpdateVehicle(m_RLCharacter.m_FrameData.m_Current.nVehicleTrack, TRUE);
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = m_RLCharacter.ResumeAnimationStatus(&RLCharacterDisplayData);
    KGLOG_CHECK_ERROR(nRetCode);

    nRetCode = m_RLCharacter.UpdateBalloon();
    KGLOG_PROCESS_ERROR(nRetCode);

    nRetCode = m_RLCharacter.UpdateTitleMark();
    KGLOG_PROCESS_ERROR(nRetCode);

    UpdateSkillBuff();

    m_bSheath = m_RLCharacter.m_FrameData.m_Current.bSheathFlag;
    m_RLCharacter.UpdateWeaponSocketPosition(m_bSheath);

    nResult = true;
Exit0:
    return nResult;
}
コード例 #9
0
CylinderFit3<Real>::CylinderFit3 (int numPoints, const Vector3<Real>* points,
    Vector3<Real>& center, Vector3<Real>& axis, Real& radius, Real& height,
    bool inputsAreInitialGuess)
{
    Real invRSqr = (Real)1;
    if (!inputsAreInitialGuess)
    {
        // Find the least-squares line that fits the data and use it as an
        // initial guess for the cylinder axis.
        Line3<Real> line = OrthogonalLineFit3(numPoints, points);
        center = line.Origin;
        axis = line.Direction;
    }

    mError = Math<Real>::MAX_REAL;
    const int iMax = 8;
    int i;
    for (i = 0; i < iMax; ++i)
    {
        mError = UpdateInvRSqr(numPoints, points, center, axis, invRSqr);
        mError = UpdateDirection(numPoints, points, center, axis, invRSqr);
        mError = UpdateCenter(numPoints, points, center, axis, invRSqr);
    }

    // Compute the radius.
    radius = Math<Real>::InvSqrt(invRSqr);

    // Project points onto fitted axis to determine extent of cylinder along
    // the axis.
    Real tMin = axis.Dot(points[0] - center);
    Real tMax = tMin;
    for (i = 1; i < numPoints; ++i)
    {
        Real t = axis.Dot(points[i] - center);
        if (t < tMin)
        {
            tMin = t;
        }
        else if (t > tMax)
        {
            tMax = t;
        }
    }

    // Compute the height.  Adjust the center to point that projects to
    // midpoint of extent.
    height = tMax - tMin;
    center += (((Real)0.5)*(tMin + tMax))*axis;
}
コード例 #10
0
void CPlayerBase::Moving()
{
	PROFILE_FUNCTION("moving base");
	if (checkFalling()) {
		time_start_falling = 0;
		ChangeState("start_falling");
		ChangeCommonState("start_falling");
	}
	UpdateDirection();
	UpdateJumpState();
	if (!UpdateMovDirection()) {
		ChangeState("idle");
		ChangeCommonState("idle");
	}
}
コード例 #11
0
CylinderFit3<Real>::CylinderFit3 (int iQuantity, const Vector3<Real>* akPoint,
    Vector3<Real>& rkC, Vector3<Real>& rkU, Real& rfR, Real& rfH,
    bool bInputsAreInitialGuess)
{
    Real fInvRSqr = (Real)1.0;
    if (!bInputsAreInitialGuess)
    {
        // Find the least-squares line that fits the data and use it as an
        // initial guess for the cylinder axis.
        Line3<Real> kLine = OrthogonalLineFit3(iQuantity,akPoint);
        rkC = kLine.Origin;
        rkU = kLine.Direction;
    }

    m_fError = Math<Real>::MAX_REAL;
    const int iMax = 8;
    int i;
    for (i = 0; i < iMax; i++)
    {
        m_fError = UpdateInvRSqr(iQuantity,akPoint,rkC,rkU,fInvRSqr);
        m_fError = UpdateDirection(iQuantity,akPoint,rkC,rkU,fInvRSqr);
        m_fError = UpdateCenter(iQuantity,akPoint,rkC,rkU,fInvRSqr);
    }

    // Compute the radius.
    rfR = Math<Real>::InvSqrt(fInvRSqr);

    // Project points onto fitted axis to determine extent of cylinder along
    // the axis.
    Real fTMin = rkU.Dot(akPoint[0]-rkC), fTMax = fTMin;
    for (i = 1; i < iQuantity; i++)
    {
        Real fT = rkU.Dot(akPoint[i]-rkC);
        if (fT < fTMin)
        {
            fTMin = fT;
        }
        else if (fT > fTMax)
        {
            fTMax = fT;
        }
    }

    // Compute the height.  Adjust the center to point that projects to
    // midpoint of extent.
    rfH = fTMax - fTMin;
    rkC += ((Real)0.5)*(fTMin+fTMax)*rkU;
}
コード例 #12
0
ファイル: camera.cpp プロジェクト: rokn/GEAR
	void Camera::Turn(GLfloat xAmount, GLfloat yAmount)
	{
		_yaw += xAmount;
		_pitch += yAmount;
		
		if(_pitch > 89)
		{
			_pitch = 89;
		}
		else if(_pitch < -89)
		{
			_pitch = -89;
		}
		
		UpdateDirection();
	}
コード例 #13
0
ファイル: krlremotecharacter.cpp プロジェクト: 1suming/pap2
int KRLRemoteCharacter::Update(double fTime, double fTimeLast, DWORD dwGameLoop, BOOL bFrame)
{
    int nRetCode = false;
    int nResult = false;
    HRESULT hr = E_FAIL;
    RL_ANIMATION_DOWN nAnimationDown = RL_ANIMATION_DOWN_NONE;
    RL_ADVANCE nAdvance = RL_ADVANCE_FORWARD;

    if (m_RLCharacter.m_RenderData.HasLoadedMDL())
    {
        if (!m_RLCharacter.IsFadeOut() && m_FrameData.m_pCharacter)
        {
            if (bFrame)
            {
                m_FrameData.UpdateRepresentFrameData(
                    m_RLCharacter.m_RenderData.IsVisible(), 
                    m_FrameData.GetCurrentPosition());
            }

            nRetCode = m_FrameData.Interpolate(m_RLCharacter.m_RenderData.IsVisible(), false);
            KGLOG_PROCESS_ERROR(nRetCode);

            nRetCode = UpdatePosition(FALSE);
            KGLOG_PROCESS_ERROR(nRetCode);

            if (bFrame)
            {
				nRetCode = UpdateYaw(&nAdvance);
				KGLOG_PROCESS_ERROR(nRetCode);
            }

            nRetCode = UpdateDirection(TRUE);
            KGLOG_PROCESS_ERROR(nRetCode);

            if (bFrame)
            {
                nRetCode = UpdateSheath();
                KGLOG_PROCESS_ERROR(nRetCode);

	            nAnimationDown = GetRLAnimationDown(
	                m_FrameData.m_Current.nMoveState, 
	                m_FrameData.m_Current.nOTAction,
	                m_FrameData.m_Current.nJumpCount,
	                m_nTurning);

                if (m_RLCharacter.m_bAnimationPaused && nAnimationDown != RL_ANIMATION_DOWN_FREEZE)
                    m_RLCharacter.PauseAnimation(FALSE);

                nRetCode = UpdateAnimationUp();
                KGLOG_PROCESS_ERROR(nRetCode);

                nRetCode = m_RLCharacter.UpdateVehicle(
                    m_FrameData.m_Current.nVehicleTrack, 
                    FALSE);
                KGLOG_PROCESS_ERROR(nRetCode);

                nRetCode = m_RLCharacter.UpdateAnimationDown(nAnimationDown, nAdvance,
                    m_FrameData.m_Current.bSlip,
                    m_FrameData.m_Current.nFightFlag,
                    m_FrameData.m_Current.dwSkillBuffs);
                KGLOG_PROCESS_ERROR(nRetCode);

                UpdateLifeState(FALSE);
                
                UpdateAnimationSpeed(nAnimationDown, nAdvance);
            }
        }

        if (bFrame)
        {
            m_RLCharacter.UpdateFade();

            hr = m_RLCharacter.m_RenderData.Update();
            KGLOG_COM_PROCESS_ERROR(hr);

            if (!IS_PLAYER(m_RLCharacter.GetObjectID()))
            {
                BOOL bSelectable = m_RLCharacter.m_RenderData.IsMDLSelectable();

                if (nAnimationDown == RL_ANIMATION_DOWN_DEATH && bSelectable)
                {
                    nRetCode = m_RLCharacter.SetSelectable(FALSE);
                    KGLOG_PROCESS_ERROR(nRetCode);
                } 
                else if (nAnimationDown != RL_ANIMATION_DOWN_DEATH && 
                    !bSelectable && 
                    m_FrameData.m_pCharacter)
                {
                    nRetCode = m_RLCharacter.ResetSelectable();
                    KGLOG_PROCESS_ERROR(nRetCode);
                }
            }
        }
    }

    nResult = true;
Exit0:
    return nResult;
}
コード例 #14
0
ファイル: PlayerController.cpp プロジェクト: mryuup/BoaBubba
 void PlayerController::Update()
 {
     UpdateDirection();
     UpdateSpeed();
 }
コード例 #15
0
ファイル: krllocalcharacter.cpp プロジェクト: viticm/pap2
int KRLLocalCharacter::Update(double fTime, double fTimeLast, DWORD dwGameLoop, BOOL bFrame)
{
    int nRetCode = false;
    int nResult = false;
    HRESULT hr = E_FAIL;
    RL_ANIMATION_UP nAnimationUp = RL_ANIMATION_UP_NONE;
    RL_ANIMATION_DOWN nAnimationDown = RL_ANIMATION_DOWN_NONE;
    RL_ADVANCE nAdvance = RL_ADVANCE_FORWARD;

    ASSERT(!m_RLCharacter.IsFadeOut());

    if (m_RLCharacter.m_RenderData.HasLoadedMDL())
    {
        if (bFrame)
        {
            m_RLCharacter.m_FrameData.UpdateRepresentFrameData(TRUE);

            if (m_bSheath != m_RLCharacter.m_FrameData.m_Current.bSheathFlag)
            {
                m_bSheath = m_RLCharacter.m_FrameData.m_Current.bSheathFlag;
                m_RLCharacter.UpdateSheath(m_bSheath);
            }
        }

        nRetCode = m_RLCharacter.m_FrameData.Interpolate(m_RLCharacter.m_RenderData.IsVisible(), false);
        KGLOG_PROCESS_ERROR(nRetCode);

        nRetCode = UpdatePosition();
        KGLOG_PROCESS_ERROR(nRetCode);

        nRetCode = UpdateDirection();
        KGLOG_PROCESS_ERROR(nRetCode);

        nAnimationDown = GetRLAnimationDown(
                             m_RLCharacter.m_FrameData.m_Current.nMoveState,
                             m_RLCharacter.m_FrameData.m_Current.nOTAction,
                             m_RLCharacter.m_FrameData.m_Current.nJumpCount,
                             m_nTurning);

        nAdvance = GetAdvance(nAnimationDown);

        nRetCode = UpdateListener();
        KGLOG_PROCESS_ERROR(nRetCode);

        if (bFrame)
        {
            if (m_RLCharacter.m_bAnimationPaused && nAnimationDown != RL_ANIMATION_DOWN_FREEZE)
                m_RLCharacter.PauseAnimation(FALSE);

            nAnimationUp = GetRLAnimationUp(m_RLCharacter.m_FrameData.m_Current.nOTAction);

            if (nAnimationUp == RL_ANIMATION_UP_NONE && m_nAnimationUp != RL_ANIMATION_UP_NONE ||
                    nAnimationUp != RL_ANIMATION_UP_NONE)
            {
                nRetCode = m_RLCharacter.UpdateAnimationUp(nAnimationUp);
                KGLOG_PROCESS_ERROR(nRetCode);

                m_nAnimationUp = nAnimationUp;
            }

            nRetCode = m_RLCharacter.UpdateVehicle(
                           m_RLCharacter.m_FrameData.m_Current.nVehicleTrack,
                           FALSE);
            KGLOG_PROCESS_ERROR(nRetCode);

            nRetCode = m_RLCharacter.UpdateAnimationDown(nAnimationDown, nAdvance,
                       m_RLCharacter.m_FrameData.m_Current.nFightFlag,
                       m_RLCharacter.m_FrameData.m_Current.dwSkillBuffs);
            KGLOG_PROCESS_ERROR(nRetCode);

            UpdateLifeState();

            UpdateAnimationSpeed(nAnimationDown, nAdvance);

            if (m_dwLockControlFrame > 0)
            {
                --m_dwLockControlFrame;
            }

            hr = m_RLCharacter.m_RenderData.Update();
            KGLOG_COM_PROCESS_ERROR(hr);
        }
    }

    nResult = true;
Exit0:
    return nResult;
}
コード例 #16
0
void BaseGridMovementComponent::OnPositionChanged(const Point3F& oldPos, const Point3F& newPos)
{
	UpdateDirection(oldPos.To2D(), newPos.To2D());
}