Page 1 of 1

This rectangle doesn't want to touch my balls :(

Posted: Mon Sep 01, 2008 5:28 pm
by Kuromeku
Dig this:

http://kudomiku.com/dump/envy.love

Are my balls too manly for it? Oh and when you click on an entity and hold it down you're supposed to be able to move it with the mouse but that fails too, it goes in a wierd direction as if setPosition wants a local position (WTF).

Re: This rectangle doesn't want to touch my balls :(

Posted: Mon Sep 01, 2008 6:25 pm
by rude
I think maybe the ground shape was garbage collected. It works now. As for controlling stuff with the mouse ... I didn't find the offending piece of code fast enough. I know body:setPosition() works fine, that's how stuff is reset in lovalanche.love.

Tip! (for everyone). When you're done adding shapes to a body, call body:setMassFromShapes().

Re: This rectangle doesn't want to touch my balls :(

Posted: Mon Sep 01, 2008 6:46 pm
by Kuromeku
Thank you! :D

Re: This rectangle doesn't want to touch my balls :(

Posted: Mon Sep 01, 2008 6:51 pm
by Kuromeku
Are the x and y positions of shapes the same as x and y positions of the body?

Or are they local the body and where would 0 be by default on a new body?

Re: This rectangle doesn't want to touch my balls :(

Posted: Mon Sep 01, 2008 6:58 pm
by bartbes
Found your second problem, setVelocity (in entity) is accidentily declared as setPosition too, so it thinks it has to set the velocity instead of the position. I'll upload 3.

Re: This rectangle doesn't want to touch my balls :(

Posted: Mon Sep 01, 2008 7:18 pm
by Kuromeku
Thank you!

And my final problem, applyForce and applyImpulse to nothing :(

And I'd use setVelocity but that stops all current motion.

Re: This rectangle doesn't want to touch my balls :(

Posted: Mon Sep 01, 2008 7:35 pm
by bartbes
It might be something wrong with the calling, as that isn't included in the .love provided, however I haven't worked with the physics engine myself. You said you could also use setVelocity but it doesnt add to the old velocity, what about a combination with getVelocity()?

Re: This rectangle doesn't want to touch my balls :(

Posted: Mon Sep 01, 2008 7:36 pm
by Kuromeku
I'm dumb.

Thanks!

Re: This rectangle doesn't want to touch my balls :(

Posted: Mon Sep 01, 2008 11:21 pm
by mike
I just wanted to add that the title of this thread made me LOL for reals.