当前位置: 首页>>代码示例>>C++>>正文


C++ Vector2::IsInRange方法代码示例

本文整理汇总了C++中Vector2::IsInRange方法的典型用法代码示例。如果您正苦于以下问题:C++ Vector2::IsInRange方法的具体用法?C++ Vector2::IsInRange怎么用?C++ Vector2::IsInRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Vector2的用法示例。


在下文中一共展示了Vector2::IsInRange方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: CollideCircleCircle

	bool Collider::CollideCircleCircle(CircleCollider* a, CircleCollider* b, CollisionData *collisionData)
	{
		//TODO: store data in collisionData!

		Vector2 diff = b->GetCenter() - a->GetCenter();
		return (diff.IsInRange(a->radius + b->radius));
	}
开发者ID:lele85,项目名称:Monocle-Engine,代码行数:7,代码来源:Collider.cpp

示例2: IntersectsPoint

	bool CircleCollider::IntersectsPoint(const Vector2& point, CollisionData *collisionData)
	{
		Vector2 ePos = GetEntityPosition();

		Vector2 diff = point - (ePos + offset);
		return (diff.IsInRange(radius));
	}
开发者ID:lele85,项目名称:Monocle-Engine,代码行数:7,代码来源:CircleCollider.cpp

示例3: CollideCircleCircle

	bool Collider::CollideCircleCircle(CircleCollider* a, CircleCollider* b)
	{
		Vector2 aOff = a->GetEntityPosition();
		Vector2 bOff = b->GetEntityPosition();

		Vector2 diff = (b->offset + bOff) - (a->offset + aOff);
		return (diff.IsInRange(a->radius + b->radius));
	}
开发者ID:safetydank,项目名称:Monocle-Engine,代码行数:8,代码来源:Collider.cpp

示例4: CollideCircleCircle

	bool Collider::CollideCircleCircle(CircleCollider* a, CircleCollider* b, CollisionData *collisionData)
	{
		Vector2 diff = a->GetCenter() - b->GetCenter();
		if (diff.IsInRange(a->GetRadius() + b->GetRadius()))
		{
			if (collisionData)
			{
				collisionData->normal = diff.GetNormalized();
				collisionData->penetration = (a->GetRadius() + b->GetRadius()) - diff.GetMagnitude();
				collisionData->hitPoint = diff * 0.5f + b->GetCenter();
			}
			return true;
		}
		return false;
	}
开发者ID:amackworth,项目名称:Monocle-Engine,代码行数:15,代码来源:Collider.cpp

示例5: GetNearestEntityByControlPoint

	Entity* Scene::GetNearestEntityByControlPoint(const Vector2 &position, const std::string &tag, Entity *ignoreEntity)
	{
		float smallestSqrMag = -1.0f;

		Entity *nearestEntity = NULL;

		std::list<Entity*> *entities = &this->entities;

		if (tag != "")
		{
			entities = GetAllTag(tag);
		}

		if (entities != NULL)
		{
			for (std::list<Entity*>::iterator i = entities->begin(); i != entities->end(); ++i)
			{
				if ((*i) != ignoreEntity)
				{
					Vector2 diff = (*i)->GetWorldPosition() - position;
					if (diff.IsInRange(ENTITY_CONTROLPOINT_SIZE))
					{
						float sqrMag = diff.GetSquaredMagnitude();
						if (smallestSqrMag == -1 || sqrMag < smallestSqrMag)
						{
							smallestSqrMag = sqrMag;
							nearestEntity = (*i);
						}
					}
				}

				//Entity *nearestChild = (*i)->GetNearestEntityByControlPoint(position, tag, ignoreEntity, smallestSqrMag);
				//if (nearestChild)
				//{
				//	nearestEntity = nearestChild;
				//}
			}
		}


		return nearestEntity;
	}
开发者ID:amackworth,项目名称:Monocle-Engine,代码行数:42,代码来源:Scene.cpp

示例6: CollideCircleCircle

bool Collider::CollideCircleCircle(CircleCollider* a, CircleCollider* b)
{
    Vector2 diff = b->GetCenter() - a->GetCenter();
    return (diff.IsInRange(a->radius + b->radius));
}
开发者ID:FrozenCow,项目名称:Monocle-Engine,代码行数:5,代码来源:Collider.cpp


注:本文中的Vector2::IsInRange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。