Are there any more, like, extensive physics tutorials?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
miloguy
Prole
Posts: 32
Joined: Sat Jul 02, 2011 2:09 am

Are there any more, like, extensive physics tutorials?

Post by miloguy »

I've had problems with making physics stuff not making things rotate and the tutorial just makes a ball which doesn't solve any problems... just asking
User avatar
tsturzl
Party member
Posts: 161
Joined: Fri Apr 08, 2011 3:24 am

Re: Are there any more, like, extensive physics tutorials?

Post by tsturzl »

The physics world just calculates what happens to objects of a certain shape, size, mass, etc. Give it the right variables and it'll give you your outcome.

If you want a ball that will rotate, thats lets say 20 in mass, 50x50 px you'd create a body then a shape to the body, create a sprite in the graphics world, then calculate a physics step, update the spite to the physics body rotation, x, and y. The rest is done for you. Its not that hard, just takes some getting used to.

If you give me a simple example of what you want I can write it up quick and post a .love


this brings me back to my days with ODE and Pygame... I still have nightmares :cry:
User avatar
miloguy
Prole
Posts: 32
Joined: Sat Jul 02, 2011 2:09 am

Re: Are there any more, like, extensive physics tutorials?

Post by miloguy »

But I like, made a rectangle body that was tilted at 45 degrees and when it fell and hit the ground it didn't lean over...
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Are there any more, like, extensive physics tutorials?

Post by slime »

How are you drawing the rectangle shape? You should be using shape:getPoints() rather than shape:getBoundingBox().
User avatar
miloguy
Prole
Posts: 32
Joined: Sat Jul 02, 2011 2:09 am

Re: Are there any more, like, extensive physics tutorials?

Post by miloguy »

I made it draw an image and it showed it rotated at an angle, but the rotation didn't change when it hit the ground.

Also: Would it be a bad idea to set everything's mass to 1? The code this thread was created about (notice I posted it quite a while ago) i got rid of I'm pretty sure but I could recreate it, maybe it'd work then idk
pancakepalace
Prole
Posts: 40
Joined: Wed Aug 03, 2011 3:13 pm

Re: Are there any more, like, extensive physics tutorials?

Post by pancakepalace »

I'm currently working on an editor for box2D in Love. I'll be releasing the first step very soon and that might help you a lot. The first step is just a parser that parses a data set you give it and handles the creation of all your bodies, shapes, and joints. The next step will be to make an editor that saves to this format I'm working on.

My idea is to group bodies, shapes, and joints into what I'm calling sets. A set is basically a bunch of bodies that work together with joints. Once you have that setup, you can create as many entities of that set that you want. And, you can scale and rotate this entities as will.

I'll have some code examples in a few days.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 136 guests