Humper icon indicating copy to clipboard operation
Humper copied to clipboard

Vector2 Math

Open implicit-invocation opened this issue 8 years ago • 0 comments

https://github.com/aloisdeniel/Humper/blob/master/Sources/Humper/Hit.cs#L350

Is the math here correct? origin was modified before calculating thanDistance
I tried to load this TMX and build some walls. But my body always goes through wall#13 and stick to the bottom side of wall#9

<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" tiledversion="1.0.1" orientation="orthogonal" renderorder="right-down" width="10" height="10" tilewidth="32" tileheight="32" nextobjectid="14">
 <objectgroup name="Obstacles">
  <object id="7" x="46.6667" y="-6.66667" width="32" height="162.667"/>
  <object id="9" x="-6" y="11.3333" width="250" height="32"/>
  <object id="10" x="5.33333" y="54.6667" width="62.6667" height="63.3333"/>
  <object id="13" x="120" y="110.667" width="138" height="43.3333"/>
 </objectgroup>
</map>
map = new TmxMap("test.tmx");
world = new World(map.Width, map.Height);
body = world.Create(100, 100, 20, 20);

foreach(var obj in map.ObjectGroups["Obstacles"].Objects) {
  walls.Add(world.Create((float)obj.X, (float)obj.Y, (float)obj.Width, (float)obj.Height));
}

implicit-invocation avatar Jun 16 '17 19:06 implicit-invocation