Jump to content


Photo

Physics Examples List


  • Please log in to reply
43 replies to this topic

#1 Mr Game

Mr Game

    GMC Member

  • New Member
  • 177 posts
  • Version:GM8

Posted 30 May 2012 - 03:03 PM

As I saw that my GMS Wishlist topic had success, and many have problems with the new GM:Studio's Physics functions, I decided to make a topic where you can ask to add a request for a physics example, or to post it if you already have made one.
Again, PLEASE DON'T REPEAT YOUR REQUESTS. If it wasn't accepted, there must be a cause.

Physics example requests:
-Water physics
-Static objects
-Mouse joint
-Pinball
-"Wiggly" shape
-Zero gravity
-Angular gravity fields
-


Available physics examples:
-Making joints with mouse http://www.solidfile...m/d/8e70d751c0/
by JumpMan16

Edited by Mr Game, 01 June 2012 - 12:08 PM.

  • 1

#2 Research

Research

    GMC Member

  • GMC Member
  • 81 posts

Posted 30 May 2012 - 03:42 PM

Mainly platform game physics.
Secondly all oficial Box2D examples: http://code.google.com/p/box2d-html5/

Edited by Research, 30 May 2012 - 03:44 PM.

  • 1

#3 ParrotPeach

ParrotPeach

    GMC Member

  • New Member
  • 82 posts
  • Version:GM:Studio

Posted 30 May 2012 - 04:10 PM

+1 I agree. That's awesome. http://code.google.com/p/box2d-html5/

Edited by ParrotPeach, 30 May 2012 - 04:12 PM.

  • 0

#4 Jack Indie Box

Jack Indie Box

    GMC Member

  • GMC Member
  • 1460 posts
  • Version:GM:Studio

Posted 30 May 2012 - 04:27 PM

of that official example go to "edge shape" can someone explain/ how to make wingly shpaes as i thought game maker(if not box 2d) cannot do concave shapes. if you know how to do wigly shapes especially iregular ones please gimme a game maker example file plz as i know how to do multi fixtues but thats not going to work to make a wigly shape but other more basic concave shapes.
  • 0

#5 SamBaylus

SamBaylus

    GMC Member

  • GMC Member
  • 89 posts

Posted 30 May 2012 - 05:16 PM

Requesting a "mouse joint" example, showing how you can pick up objects with the mouse, swing them around, and let go of the objects while they retain their momentum from the drag.

Requesting a "pinball" example, showing how you can implement the plunger using a prismatic joint and flippers.
  • 1

#6 Mr Game

Mr Game

    GMC Member

  • New Member
  • 177 posts
  • Version:GM8

Posted 30 May 2012 - 06:05 PM

+1 I agree. That's awesome. http://code.google.com/p/box2d-html5/

We are speakin' about GMS BUILT-IN functions. Not an external engine

And remember, while you're requesting something, if you see on the list a thing that you're able to do POST THAT!
  • 0

#7 SamBaylus

SamBaylus

    GMC Member

  • GMC Member
  • 89 posts

Posted 30 May 2012 - 06:14 PM

Well I see "static objects" are on the list. Can't you simply set an object with density "0"? Objects are static by default.

Edited by SamBaylus, 30 May 2012 - 06:15 PM.

  • 0

#8 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 16794 posts
  • Version:GM:Studio

Posted 30 May 2012 - 06:17 PM

Well I see "static objects" are on the list. Can't you simply set an object with density "0"? Objects are static by default.


Correct.
  • 0

#9 Mr Game

Mr Game

    GMC Member

  • New Member
  • 177 posts
  • Version:GM8

Posted 30 May 2012 - 06:21 PM

Well I see "static objects" are on the list. Can't you simply set an object with density "0"? Objects are static by default.

Did you try it? I don't know if I'm making it wrong, but it doesn't work :\
  • 0

#10 SamBaylus

SamBaylus

    GMC Member

  • GMC Member
  • 89 posts

Posted 30 May 2012 - 06:52 PM

Yeah, I've tried it several times. A static object is one that does not move or collide (right?). Bind it to a fixture with the density at "0" and it'll simply float there in place. Bam! Static.

In an object's room_start event. The object has a circular sprite with the origin at it's CENTER.
fix = physics_fixture_create();
physics_fixture_set_circle_shape(fix, sprite_width /2);
physics_fixture_set_density(fix, 0);
physics_fixture_bind(fix, id);
physics_fixture_delete(fix);

Now, if you have enabled a room with gravity, other objects with a density higher than "0" will fall, but this handy-dandy object will float in space!
  • 1

#11 Nocturne

Nocturne

    Nocturne Games

  • Administrators
  • 16794 posts
  • Version:GM:Studio

Posted 30 May 2012 - 07:09 PM

Yeah, I've tried it several times. A static object is one that does not move or collide (right?). Bind it to a fixture with the density at "0" and it'll simply float there in place. Bam! Static.

In an object's room_start event. The object has a circular sprite with the origin at it's CENTER.

fix = physics_fixture_create();
physics_fixture_set_circle_shape(fix, sprite_width /2);
physics_fixture_set_density(fix, 0);
physics_fixture_bind(fix, id);
physics_fixture_delete(fix);

Now, if you have enabled a room with gravity, other objects with a density higher than "0" will fall, but this handy-dandy object will float in space!


I repeat... Correct. Posted Image
  • 0

#12 Mr Game

Mr Game

    GMC Member

  • New Member
  • 177 posts
  • Version:GM8

Posted 30 May 2012 - 07:44 PM

So... when other objects collide with this "static object" they'll bounce away, right?
  • 0

#13 Research

Research

    GMC Member

  • GMC Member
  • 81 posts

Posted 30 May 2012 - 08:39 PM


+1 I agree. That's awesome. http://code.google.com/p/box2d-html5/

We are speakin' about GMS BUILT-IN functions. Not an external engine

And remember, while you're requesting something, if you see on the list a thing that you're able to do POST THAT!

That external engine is the internal GMS built-in functions.
So what kind of examples would be better?

Edited by Research, 30 May 2012 - 08:42 PM.

  • 0

#14 JumpMan16

JumpMan16

    GMC Member

  • GMC Member
  • 219 posts
  • Version:GM:Studio

Posted 31 May 2012 - 01:34 AM

I was going to create a topic to ask my question, but the project I included might be useful to some people, so this seems like a good place. I'm creating a system to allow the user to build various structures out of several fixtures. Currently I'm just using squares. In the included project, you can move fixtures around by clicking on nodes that are attached to them. If you drag and release a node from one fixture, onto the node of another fixture, you can create a joint between the two fixtures. I didn't attach the nodes to the fixtures using joints, but instead the nodes move the fixture directly, and the joints you can create are connected to the fixtures not the nodes, the nodes are just an interface.

This all works pretty well, but one undesired result is that the entire object you create isn't stiff enough. The easiest way to see this is to connect all of the squares together in a row. When you move the resulting object around from one point, the rest of the fixtures lag behind. The entire object acts like jello or something. As fun as jello is, it's not the result I'm looking for. I would like all of the fixtures to be stiff like one solid object.

I've tried using all of the different joints, changing fixture properties, and changing the physics update speed / iterations. The latter made it feel a little more stiff, but not enough. I haven't been playing with physics for very long, so some insight on this issue would be appreciated. The project itself demonstrates how to do a couple simple things like dragging objects with the mouse or with joints, so that might be useful to some.

Download

It wasn't coded to be user safe, so don't deliberately try to break anything, or you'll just end up with a pile of twitching fixtures.

Edit : objBody is the one used in the room, objEditBody was just a test for something, so just ignore that object.

Edited by JumpMan16, 31 May 2012 - 01:49 AM.

  • 1

#15 Mr Game

Mr Game

    GMC Member

  • New Member
  • 177 posts
  • Version:GM8

Posted 31 May 2012 - 11:23 AM



+1 I agree. That's awesome. http://code.google.com/p/box2d-html5/

We are speakin' about GMS BUILT-IN functions. Not an external engine

And remember, while you're requesting something, if you see on the list a thing that you're able to do POST THAT!

That external engine is the internal GMS built-in functions.
So what kind of examples would be better?

This thread is supposed to bee n00b friendly. If you know how to use Box2D javascript examples in GMS, post a tutorial.
  • 0

#16 Tennx

Tennx

    The Entrepreneur

  • GMC Member
  • 259 posts
  • Version:GM:Studio

Posted 31 May 2012 - 04:16 PM

Okay. Then I want to simulate angular gravity fields (http://en.wikipedia.org/wiki/Newton's_law_of_universal_gravitation).

Why? Because having a polar system as Angry Birds Space does could be fun. Is there a way to do that? :D.
  • 0

#17 Jack Indie Box

Jack Indie Box

    GMC Member

  • GMC Member
  • 1460 posts
  • Version:GM:Studio

Posted 31 May 2012 - 05:36 PM

im pretty sure you could do that easily, i have 0 experience of the physics yet so cant help but i would just apply a force toward a point at basic level that would work, but you would have to check the position of the current object and distance to nearest field(using the physics coordinate system-cant remember variables- instead of x) but im sure someone that has used box 2d in GM can knock it up and its a good thing to request :D
  • 0

#18 Mr Game

Mr Game

    GMC Member

  • New Member
  • 177 posts
  • Version:GM8

Posted 31 May 2012 - 08:23 PM

Okay. Then I want to simulate angular gravity fields (http://en.wikipedia.org/wiki/Newton's_law_of_universal_gravitation).

Why? Because having a polar system as Angry Birds Space does could be fun. Is there a way to do that? :D.

What a coincidence! I was working exactly on something similar!
As I really have no experience with Box2D, I planned making my own physics engine, but I'll try again with Box2D.

Also zero gravity looks like it's going to be impossible

EDIT: it looks like users of Box2D for other platforms can't get zero gravity to work too.

EDIT2: Found it! I found a tutorial that explains how to make AG Space-like gravity with Box2D! It's C++, so just read the comments, the code is useless to us. http://www.emanuelef...ry-birds-space/

Edited by Mr Game, 31 May 2012 - 08:45 PM.

  • 0

#19 scurvycapn

scurvycapn

    GMC Member

  • GMC Member
  • 171 posts
  • Version:GM:Studio

Posted 31 May 2012 - 08:26 PM

A developer named Emanuele Feronato has a whopping 128 box2d related articles on his site (http://www.emanuelef...category/box2d/) including one on simulating radial gravity a la Angry Birds Space (http://www.emanuelef...ry-birds-space/). All of the examples are done in Flash using box2d, but I'm sure most of them could be translated into GameMaker.
  • 0

#20 Mr Game

Mr Game

    GMC Member

  • New Member
  • 177 posts
  • Version:GM8

Posted 31 May 2012 - 09:15 PM

A developer named Emanuele Feronato has a whopping 128 box2d related articles on his site (http://www.emanuelef...category/box2d/) including one on simulating radial gravity a la Angry Birds Space (http://www.emanuelef...ry-birds-space/). All of the examples are done in Flash using box2d, but I'm sure most of them could be translated into GameMaker.

The answer is simple: don't translate the code, translate the concept itself to GML. That should be relatively simple :)
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users