Author Topic: Physics2D  (Read 10342 times)

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2738
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Physics2D
« Reply #15 on: 2011-08-05, 05:15:41 AM »
1. I'm using Physics2D.Net, not Box2D, and as far as I know, Physics2D.Net doesn't have a ground object.  However, I might be able to create a dummy object with infinite mass that ignores collisions and anchor the joint to that.
2. The problem is, I kind of had to choose between SGDK2 physics and 3rd-party physics.  I don't think mixing them works well.  I guess I didn't try, but if I leave the platforms out of the physics engine's model, then I have to figure out how to tell sprites that are in the model to position and move themselves like they are still using SGDK2 physics.  I need to develop new logic to decide what happens, for example, when a sprite hits another sprite that is riding the platform.  I have to merge the SGDK2 physics that was telling the sprite's inertia to follow that of the platform with the 3rd party physics that is telling the sprite to move away (and probably even rotate!) as a result of being hit.  It's too hard to use 2 physics engines, I think, so I just throw everything into the physics engine and it all takes care of itself for the most part.  I just need to figure out how to manipulate things via the physics engine instead of directly.  I have toyed with the thought, though, of limiting which sprites are represented in the physics engine.  I think I just talked myself out of it :), but it's still in the back of my mind -- having participation in realistic physics be implemented more like an additional rule instead of intrinsic to the project's "engine".

v6v

  • Clever
  • Fanatic
  • ***
  • Posts: 500
  • Has renamed his project to Galaxy!
    • View Profile
    • My Developer Page!
    • Email
Re: Physics2D
« Reply #16 on: 2011-08-05, 11:34:12 AM »
whoa I came back from vacation and saw this... this is AMAZING. lol I guess this comment  is more of a complimenting comment than anything else- really cool project!

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2738
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Physics2D
« Reply #17 on: 2011-08-05, 02:31:39 PM »
Did you get it to run, Pizzaman?

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2738
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Physics2D
« Reply #18 on: 2011-08-07, 11:19:51 AM »
The SGDK2PhysicsDemo.zip file has been updated.  Now you can see how arbitrary shapes can be used.  Platforms are easier to ride now too.

Vincent

  • SGDK2 Addict
  • Expert
  • Fanatic
  • *****
  • Posts: 610
  • Legacy of Kain: Revival is completed!!!
    • View Profile
    • Chivalrous Games
    • Email
Re: Physics2D
« Reply #19 on: 2011-08-08, 02:54:42 PM »
Oooh!!!  Very nice!  I like the fact that the ship can get a start stuck between the wing and the cockpit.  Well, that would be a problem in a game, but for a technical demo, it's great! :)
Legacy of Kain: Revival completed!
http://lokrevival.webs.com

See also my company website:
http://chivalrousgames.com

v6v

  • Clever
  • Fanatic
  • ***
  • Posts: 500
  • Has renamed his project to Galaxy!
    • View Profile
    • My Developer Page!
    • Email
Re: Physics2D
« Reply #20 on: 2011-08-09, 10:20:10 AM »
It runs GREAT. The Platform thing was an issue, but then again, that is a more realistic interpretation of a floating platform. This is an amazing addition!

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2738
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Physics2D
« Reply #21 on: 2011-08-10, 05:33:54 AM »
Perhaps the most amazing part is I didn't have to deliver a new SGDK2 IDE; it's just a new template/project.

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2738
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Physics2D
« Reply #22 on: 2011-08-30, 09:45:33 AM »
Starting to work on what might become a real game.  I had an idea involving spiders, flies and webs.  It's not very developed yet though.  Use the arrow keys and the right Ctrl key (hold it down when near a fly)... you'll see what happens.
http://sgdk2.enigmadream.com/ben/Spider.zip

Vincent

  • SGDK2 Addict
  • Expert
  • Fanatic
  • *****
  • Posts: 610
  • Legacy of Kain: Revival is completed!!!
    • View Profile
    • Chivalrous Games
    • Email
Re: Physics2D
« Reply #23 on: 2011-08-30, 11:48:55 AM »
Hahaha!  I like it a lot!  Very cute.  Although the flying spider is a little weird.  (Yeah, Iknow, that's not the point of this demo.)  It's pretty impressive!   Very simple too!  Although I guess you developped the custom rules AttachTo and ReleaseWeb...
Legacy of Kain: Revival completed!
http://lokrevival.webs.com

See also my company website:
http://chivalrousgames.com

SmartBoy16

  • Contributor
  • Fanatic
  • **
  • Posts: 587
  • Looking for inspiration.....
    • View Profile
    • Email
Re: Physics2D
« Reply #24 on: 2011-08-30, 05:19:56 PM »
Nice demo. The only concern I have with it is whenever you run into the wall, you "magnetize" to it. I is there a way that you can reduce/eliminate this effect?
Looking to the skies.....

bluemonkmn

  • SGDK Author
  • Administrator
  • Fanatic
  • *****
  • Posts: 2738
    • ICQ Messenger - 2678251
    • MSN Messenger - BlueMonkMN@gmail.com
    • View Profile
    • http://sgdk2.sf.net/
    • Email
Re: Physics2D
« Reply #25 on: 2011-08-31, 05:21:28 AM »
Yeah the spider will not fly in a real game.  It will probably swing from webs or something.  Flying was just left over from the space ship physics demo on which this demo was based, and I haven't decided how the spider should move yet.  The magnetizing effect will probably go away when that goes away.  I assume you're talking about the way the spider aligns (like a box) to the wall when it hits the wall.  That's because the thrust that you apply to the spider is like gravity and the legs act like the corners of a box causing it to "land" on the floor, ceiling or walls that you're pushing toward.  But when the spider gives up its flying engines, I think that effect will go away :).  If not, I can always make the spider use a circular shape instead of its actual shape.  But I thought it would be cool to use the actual shape for the spiders and flies where so many games just use squares and circles.