deltaluca / nape

Haxe/AS3 Physics Engine
http://napephys.com
Other
542 stars 77 forks source link

having a central point for objects #96

Closed lewislepton closed 9 years ago

lewislepton commented 9 years ago

loving nape, it works great. plus damn easy, so thanks first of all

this is just something ive noticed with say polygon objects, maybe making a rectangle. but once made, then i test hits etc by using a keyboard movement with the keyboard, and hitting another object. but the object im hitting, plus my own player, does not turn naturally. the point where the line is coming from has this type of anchor on it. so when hit/moved, its lined point is much heavier. if that makes sense?

either way, here is a gif to show exactly what i mean. but was wondering how to bypass this?

thanks

gifgab

lewislepton commented 9 years ago

its really so the shape can have a more central affected area, rather than a corner, which is not realistic

thanks

deltaluca commented 9 years ago

the image just shows up as a grey quad for me?

lewislepton commented 9 years ago

oh really. i thought it was animating the gif. its not very clear. ill post another see if that works. anyhow, here is a new one

image

if that doesnt work, here are 2 images to hopefully make sense with some words ;) but in this first image im pushing down, BUT, the corner has this type of anchor on. but... screen shot 2015-06-28 at 20 52 01

when i push on the other corner that does not have the line, it pushes down a hell of a lot easier screen shot 2015-06-28 at 20 52 10

so the big block has this type of anchor in the corner where the line goes to/from

hope that helps to explain ;)

deltaluca commented 9 years ago

The line (assuming this is the inbuilt debug drawing) is just going from the centre of the polygon to its first vertex, it's not an anchor.

Without seeing any code, the only thing I can suggest is happening is that you've not created the polygon such that it's centre of mass is at (0, 0) and as such it will not behave realistically (eg you've created it with Polygon.rect(0, 0, w, h) rather than Polygon.box(w, h) == Polygon.rect(-w/2,-h/2,w,h))

lewislepton commented 9 years ago

AH, box - that was the key, plus to not have it being (0,0,w,h), but just (w,h). silly me indeed

many thanks for the help ;)