bool PhysicsEngine::spheresphere(Vector3<float>& c1,float _radius1,Vector3<float>& c2,float _radius2)
{
	Vector3<float> temp = c1;
	if(temp.x > 10)
	temp.x / 10;
	float dist=pointdistacesquare(temp,c2);
	if(std::abs(dist)<=(_radius1+_radius2)*(_radius1+_radius2))
	{
		return 1;
	}
	return 0;
}
Beispiel #2
0
bool collision::spheresphere(vector3d& c1, float r1, vector3d& c2, float r2)
{
	float dist = pointdistacesquare(c1, c2);
	if (dist <= (r1 + r2)*(r1 + r2))
	{
		float a = sqrt(dist) - (r1 + r2);
		vector3d vec(c2 - c1);
		vec.normalize();
		c1 = c1 + vec*a;
		return 1;
	}
	return 0;
}
bool spheresphere(vector3d c1,float r1,vector3d c2,float r2)
{
	return (pointdistacesquare(c1,c2)<=(r1+r2)*(r1+r2));
}