Beispiel #1
0
void CBaseGrabHandler::Update(float frameTime)
{

	//we have to restore the grabbed object collision flag at some point after the throw.
	if(m_grabStats.dropId>0)
	{
		m_grabStats.resetFlagsDelay -= frameTime;

		if(m_grabStats.resetFlagsDelay<0.001f)
		{
			IgnoreCollision(m_grabStats.dropId,m_grabStats.collisionFlags,false);
			m_grabStats.dropId = 0;
		}
	}

	if(m_grabStats.grabId<1)
		return;

	if(m_pActor->GetHealth()<=0)
	{
		StartDrop();
		return;
	}

	IEntity *pGrab = gEnv->pEntitySystem->GetEntity(m_grabStats.grabId);

	if(pGrab)
	{
		bool grabbing(m_grabStats.grabDelay>0.001f);

		if(!grabbing || m_grabStats.usingAnimation)
			UpdatePosVelRot(frameTime);
	}
	else
	{
		//in case the grabber lost the grabbed object, reset the ignore collision flags

		// FIXME Dez 14, 2006: <pvl> the following should be done by
		// calling IgnoreCollisions() but that function requires
		// id of the grabbed object => needs refactoring
		IPhysicalEntity *pActorPhys = m_pActor->GetEntity()->GetPhysics();

		if(pActorPhys)
		{
			pe_action_update_constraint uc;
			uc.bRemove = 1;

			pActorPhys->Action(&uc);
		}
	}

	// TODO Sep 13, 2007: <pvl> I strongly suspect releaseIKTime is redundant now.
	// NOTE Sep 13, 2007: <pvl> note that all timeouts are dodgy here since there's
	// no guarantee that the grabbing/throwing animation starts playing immediately
	// after the grabbing command is issued.
	if(m_grabStats.releaseIKTime>0.001f && m_grabStats.grabDelay < 0.001f)
		m_grabStats.releaseIKTime -= frameTime;
}
Beispiel #2
0
bool CBaseGrabHandler::SetDrop(SmartScriptTable &rParams)
{
	rParams->GetValue("throwVec",m_grabStats.throwVector);

	int throwImmediately(0);
	rParams->GetValue("throwImmediately",throwImmediately);

	//FIXME:
	if (throwImmediately)
	{
		StartDrop();
	}
	else if (m_grabStats.throwDelay<0.001f)
	{
		rParams->GetValue("throwDelay",m_grabStats.throwDelay);

		m_grabStats.grabDelay = 0.0f;
		m_grabStats.maxDelay = m_grabStats.throwDelay;

		StartDrop();
	}

	return true;
}
Beispiel #3
0
bool CAnimatedGrabHandler::SetDrop(SmartScriptTable &rParams)
{
	bool retval = CBaseGrabHandler::SetDrop(rParams);

	if (m_grabStats.carryAnimGraphInput[0])
	{
		m_pActor->SetAnimationInput("CarryItem","none");
	}
	if (m_grabStats.dropAnimGraphSignal[0])
	{
		m_pActor->SetAnimationInput("Signal",m_grabStats.dropAnimGraphSignal);
	}

	if ( ! m_grabStats.usingAnimationForDrop)
	{
		StartDrop();
	}
	return retval;
}