For a game I'm working on, I'm trying to create a box with perfect physics. It would be a rigid body, and fall based on how far from an edge it is. It would also need restitution and velocity for the turning to be applied as well. If anyone could help me it would be greatly appreciated. I have a few ideas, but I'd love if some of the resident physics scratchers (AB3, amcerbu, etc.) could point me in the right direction. When I get a chance I'll post a rough script. Thanks if anyone can help. I appreciate it, since this is a more difficult problem to tackle in scratch. (By all this I don't mean turn x degrees base in some sensors, I mean the real deal all out math approach. It'll likely require trig and advanced knowledge of the scratch functions).
Offline
I've been trying to figure this out for a while as well. Here's a Google document with some drawings and equations that I wrote up while I was working on figuring out the math. I sort of abandoned it (maybe this will get me back working on it again).
Anyway, here's the document. I've made it public to anyone who has the link. You don't need a Google account to view.
https://docs.google.com/document/d/1Pzo … 0RDpk/edit
Last edited by amcerbu (2012-10-15 22:17:21)
Offline
That looks scary on my phone
. I'll take a look later when I'm on my laptop, thanks.
Offline
*commenting on topic so I remember it exists*
Offline
Interesting question...looks like there's going to be a lot of math discussed here so I'll see if I can help at some point.
Offline
Wow. Did I seriously script this
when gf clicked go to x: (0) y: (-90) set [xv v] to [0] set [yv v] to [0] forever set [bleh v] to [0] set [xv v] to ((xv) * (0.9)) change x by (xv) if <touching color [#000008]?> change x by ((xv) * (-1)) set [xv v] to [0] end set [yv v] to ((yv) * (0.9)) change y by (yv) if <touching color [#000008]?> set [ytempstore v] to (yv) change y by ((yv) * (-1)) set [yv v] to [0] end if <(yv) < [4]> change y by (-1) if <not <touching color [#000008]?>> change [yv v] by (-1) end change y by (1) end set [tempdirstore v] to (direction) point in direction (90 v) change y by (-1) if <touching color [#000008]?> change x by (24) if <touching color [#000008]?> set [side v] to [l] change x by (-48) if <touching color [#000008]?> set [side v] to [none] end change x by (24) else change x by (-48) if <touching color [#000008]?> set [side v] to [r] end change x by (24) end else set [side v] to [none] end change y by (1) point in direction (tempdirstore) if <(side) = [r]> turn cw (ytempstore) degrees else turn ccw (ytempstore) degrees end end? ._.
Offline
amcerbu wrote:
Oh, it's for the Portal clone, isn't it? The companion cube, must be.
Yep. And thanks for your help, I appreciate it.
Offline
Okay, I'll probably have time to work on 2D rigid body physics over the weekend. I've compiled a bunch of PDFs about this stuff, because I intended to do some legitimate research and find out the real answer, rather than trying random things and hoping they'd work.
I've got a bunch of crazy computer science/physics papers saved in a "Physics Programming" folder. I just haven't had the chance to decipher them yet.
Offline
amcerbu wrote:
Okay, I'll probably have time to work on 2D rigid body physics over the weekend. I've compiled a bunch of PDFs about this stuff, because I intended to do some legitimate research and find out the real answer, rather than trying random things and hoping they'd work.
I've got a bunch of crazy computer science/physics papers saved in a "Physics Programming" folder. I just haven't had the chance to decipher them yet.
Awesome. You have no idea how much I appreciate all the help you've been
Offline
Good stuff, amcerbu! I'm actually in the middle of implementing an engine for this in JS here.
Offline