Page 17 of 91

Re: "Questions that don't deserve their own thread" thread

Posted: Tue Sep 09, 2014 12:56 pm
by Whatthefuck
But there is a huge difference in amount of memory used between a spritebatch that was first created and had nothing done to it and one that was filled and then cleared, why is that?

Re: "Questions that don't deserve their own thread" thread

Posted: Tue Sep 09, 2014 1:01 pm
by slime
I lied a bit - some of the memory allocation is deferred (both in LÖVE's code and, in some circumstances, in the video driver's code.) The amount of memory allocated should remain fairly constant after that though.

Re: "Questions that don't deserve their own thread" thread

Posted: Tue Sep 09, 2014 1:51 pm
by Bya
I can't get animations to work either with AnAL or anim8, so I decided I would just manually swap out images, which is working fine, except I can't figure out how to "delay" the image change instead of it being what I assume is an instantaneous swap. How would I go about delaying it?

Re: "Questions that don't deserve their own thread" thread

Posted: Tue Sep 09, 2014 2:08 pm
by Plu
You can't, not really. You'll have to delay it manually:

Code: Select all

maxTime = 0.2
curTime = 0

function love.update( dt )
  curTime = curTime + dt
  if curTime > maxTime then
    -- go to the next step of your animation
    curTime = curTime - maxTime -- for smoothness, don't just go back to 0
  end
end
Incidentally, this is exactly what anal and anim8 also do.

Re: "Questions that don't deserve their own thread" thread

Posted: Tue Sep 09, 2014 8:33 pm
by murks
I'm playing with hardoncollider. I did the tutorial once but I feel it hasn't quite prepared me, so I have a few questions.
1) Do you tie images to the shapes (coordinate-wise)? It sort of seems like the sensible thing to do, but I'm not sure.
2) Do you use move or moveTo? Is there a serious drawback to one or the other?
3) I have something like gravity (basically just velocity for the y axis) and collision with the ground. If the pc collides with the ground it gets reset to the position of the ground (using moveTo). The outline of the rectangle I'm drawing jitters up and down like crazy, that seems not a sensible thing to do. Not sure what's wrong.

Re: "Questions that don't deserve their own thread" thread

Posted: Tue Sep 09, 2014 11:59 pm
by Snackrilege
Can I get someone to clear up some wording on the wiki for me? I can't sort this out... it's from the [wiki]Fixture:setFilterData[/wiki] page on the wiki -

If two fixtures are in the same group they either always collide if the group is positive, or never collide if it's negative. Is the group zero or they do not match, then the contact filter checks if the fixtures select a category of the other fixture with their masks. The fixtures do not collide if that's not the case. If they do have each others categories selected, the return value of the custom contact filter will be used. They always collide if none was set.
The first part makes sense. Always collide or never collide if the group number matches as positive numbers or negative numbers respectively. Got it. The next part though, is a bit more confusing.

Is the group zero or they do not match, then the contact filter checks if the fixtures select a category of the other fixture with their masks.
Okay... so, the filters 'select a cetegory with their mask'... I think this means, "check to see if object_a.mask contains object_b.category or vice versa"

okay.. I can get behind that, but heres the real tricky bit next..
The fixtures do not collide if that's not the case. If they do have each others categories selected, the return value of the custom contact filter will be used. They always collide if none was set.
Okay, so if A.mask contains B.category, no collision. got it. but wait, the next sentence is "if they do have each others categories selected, the return value of the custom contact filter will be used."

huh? I thought they didnt collide? How are they getting a return value from a collision if it isn't occurring? What is the return value being used for? Which custom collision function are we talking about here? Are they colliding or are they not colliding? WHAT'S GOING ON

:)

Re: "Questions that don't deserve their own thread" thread

Posted: Wed Sep 10, 2014 1:32 am
by Dr.Tyler O.
I'm sure that almost everyone here is aware that when something like love.graphics.rectangle is executed it draws a rectangle that expands from the center point that it was created on. My question to you is, is there a way to make a rectangle only expand in a single direction on a given axis instead of it expanding in both directions?

Re: "Questions that don't deserve their own thread" thread

Posted: Wed Sep 10, 2014 1:39 am
by Snackrilege
Dr.Tyler O. wrote:Is there a way to make a rectangle only expand in a single direction on a given axis instead of it expanding in both directions?
The same difficulty happens when you are drawing rectangle shaped bodies in love.physics. I solved the problem by only using the polygon function and manually creating a rectangle --that is to say, I used love.physics.newPolygonShape(vertices of a rectangle) rather than love.physics.newRectangleShape(height and width). Using that, the rectangle s origin was the top right, as I had intended.

I'm not certain if that will work for the drawing tools as well, but perhaps it's worth investigating?

Re: "Questions that don't deserve their own thread" thread

Posted: Wed Sep 10, 2014 7:08 am
by Robin
love.graphics.rectangle(centerx - width/2, centery - height/2, width, height) should do the trick.

Re: "Questions that don't deserve their own thread" thread

Posted: Wed Sep 10, 2014 7:21 am
by Plu
Snackrilege, that's not an easy subject at all unfortunately :(

I found this tutorial which explains it pretty well, however the code samples are in some form of C (because it's explaining box2d, the system behind love.physics)

I think it'll help you understand what's going on. If you have more questions on the subject, you should probably make your own thread as it's a complicated subject that'll probably take a lot of posts to grasp.

http://www.iforce2d.net/b2dtut/collision-filtering