Example #1
0
void SensorSystem::updateScan (bool forceUpdate) {

	if (!forceUpdate)
		if ((masterIndex == -1) || (range < 0.0) || (turn < 2))
			return;

	if (!enabled()) {
		clearContacts();
		return;
	}

	if (!owner->getTeam())
		return;

	if (1/*(nextScanUpdate < scenarioTime) || forceUpdate*/) 
	{
	
		long currentScan = -1;
		if ((currentScan = scanBattlefield()) > -1)		//No returns size of largest contact.
		{
			if (owner->isMover() && 
				(owner->getTeam() == Team::home) && 
				(currentScan > SoundSystem::largestSensorContact))
			{
				SoundSystem::largestSensorContact = currentScan;
			}
		}

		lastScanUpdate = scenarioTime;
		if (!forceUpdate)
			nextScanUpdate += scanFrequency;
	}
}
Example #2
0
		void OgreOpcodeDebugger::clearAll()
		{
			clearRadii();
			clearContacts();
			clearContactNormals();
			clearShapes();
			clearBBs();
			clearAABBs();
		}
Example #3
0
void CollisionPair::setRepresentations(const std::shared_ptr<Representation>& first,
							   const std::shared_ptr<Representation>& second)
{
	SURGSIM_ASSERT(first != second) << "Should try to collide with self";
	SURGSIM_ASSERT(first != nullptr && second != nullptr) << "Collision Representation cannot be null";

	// Invalidate the current contacts
	clearContacts();
	m_representations.first = first;
	m_representations.second = second;
	m_isSwapped = false;
}
Example #4
0
void SensorSystem::updateContacts (void) {

	if ((masterIndex == -1) || (range < 0.0))
		return;

	if (!enabled()) {
		clearContacts();
		return;
	}

	//---------------------------------------------------------------------
	// If we've already scanned this frame, don't bother updating contacts.
	// Otherwise, update contacts...
	if (scenarioTime == lastScanUpdate)
		return;

	long i = 0;
	while (i < numContacts) 
	{
		MoverPtr contact = (MoverPtr)ObjectManager->get(contacts[i] & 0x7FFF);
		long contactStatus = calcContactStatus(contact);
		if (contactStatus == CONTACT_NONE)
			removeContact(i);
		else 
		{
			contacts[i] =  contact->getHandle();
			if (contactStatus == CONTACT_VISUAL)
				contacts[i] |= 0x8000;
			modifyContact(contact, contactStatus == CONTACT_VISUAL);
			
/*			if (teamContactStatus < contactStatus) {
				//--------------------------------------------------
				// Better sensor info, so update the team sensors...
				contactInfo->contactStatus[owner->getTeamId()] = contactStatus;
				contactInfo->teamSpotter[owner->getTeamId()] = (unsigned char)owner->getHandle();
			}
*/			i++;
		}
	}
}
Example #5
0
void SensorSystem::disable (void) {

	clearContacts();
}