mirror of
https://github.com/love2d/love.git
synced 2026-08-15 15:51:12 +02:00
Fix scaling errors with CircleShape's radius
--HG-- branch : box2d-update
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
// Module
|
||||
#include "Body.h"
|
||||
#include "World.h"
|
||||
#include "Physics.h"
|
||||
|
||||
#include <common/Memoizer.h>
|
||||
|
||||
@@ -46,12 +47,12 @@ namespace box2d
|
||||
|
||||
float CircleShape::getRadius() const
|
||||
{
|
||||
return shape->m_radius;
|
||||
return Physics::scaleUp(shape->m_radius);
|
||||
}
|
||||
|
||||
void CircleShape::setRadius(float r)
|
||||
{
|
||||
shape->m_radius = r;
|
||||
shape->m_radius = Physics::scaleDown(r);
|
||||
}
|
||||
|
||||
} // box2d
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace box2d
|
||||
{
|
||||
b2CircleShape *s = new b2CircleShape();
|
||||
s->m_p = Physics::scaleDown(b2Vec2(x, y));
|
||||
s->m_radius = radius;
|
||||
s->m_radius = Physics::scaleDown(radius);
|
||||
return new CircleShape(s);
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ namespace box2d
|
||||
b2DistanceOutput o;
|
||||
b2SimplexCache c;
|
||||
b2Distance(&o, &c, &i);
|
||||
lua_pushnumber(L, o.distance);
|
||||
lua_pushnumber(L, Physics::scaleUp(o.distance));
|
||||
lua_pushnumber(L, Physics::scaleUp(o.pointA.x));
|
||||
lua_pushnumber(L, Physics::scaleUp(o.pointA.y));
|
||||
lua_pushnumber(L, Physics::scaleUp(o.pointB.x));
|
||||
|
||||
Reference in New Issue
Block a user