Page 1 of 1

Shape object ideas

Posted: Fri Oct 24, 2008 2:32 pm
by Nexion
Could you maybe add a little bit more functionality w/ shapes and bodies?
Having to switch between the two is a pain without built in functions for it.
The main thing I'm thinking of is something like shape:getBody() that would simply return the body that the shape is attached to.

Re: Shape object ideas

Posted: Tue Oct 28, 2008 11:24 am
by rude
I've added this to the task list. 8-)

Re: Shape object ideas

Posted: Thu Oct 30, 2008 1:29 pm
by Nexion
Awesome.

I had another question rude, but I don't think it really calls for another thread.
Are body:destroy() and shape:destroy() depreciated? Whenever I try to use them LOVE errors and doesn't remove the shape or object.

Re: Shape object ideas

Posted: Thu Oct 30, 2008 3:24 pm
by rude
The object will only be destroyed if it really is the last reference. Shapes and joints keep internal references to their bodies, so if you destroy a body without destroying its joints and shapes, nothing will be destroyed. Order is unimportant, but everything associated with a body must be destroyed for the body itself to be freed.

Yes, yes, docs, I know.

Re: Shape object ideas

Posted: Mon Nov 03, 2008 2:30 pm
by Nexion
OK, I don't have my code in front of me but that's probably where I went wrong.

Do you think it would be possible to put a variable in the config file to tell LOVE what quadrant to be in? It would be handy to have the origin be at the bottom left in some cases instead of the top left. Just have it be an ENUM for what quadrant

Also - you and mike should just take a day and improve the docs as much as you can.

Re: Shape object ideas

Posted: Mon Nov 03, 2008 3:56 pm
by rude
You'll be able to set the viewport in a future LÖVE version. Then you can have the origin wherever you like.

Re: Shape object ideas

Posted: Fri Nov 14, 2008 11:51 pm
by MHD
I think it would be really nice that the body was the top of an entity tree (being the GarrysMod programmer I am), thus if you destroy the body, all shapes and joints will be destroyed too. It doesn't need to be :destroy() but maybe a new function called :destroytree() or similar.

Also a body:getShapes() would be nice.

Re: Shape object ideas

Posted: Sat Nov 15, 2008 11:10 am
by rude
That is possible, but it would mean death and pain for those who try to access implicitly destroyed joints and shapes. If you try to access something destroyed now, you get an error at least. With something like destroytree(), you could end up getting something closer to a segfault. Not sure I want that.

Body:getShapes() should be possible without problems, though. :D

Re: Shape object ideas

Posted: Sun Nov 16, 2008 1:48 pm
by MHD
Also, how about world:getBodies() and world:getShapes() ?

Re: Shape object ideas

Posted: Mon Nov 17, 2008 4:58 am
by rude
The reason I didn't implement all these "get" functions in the first place is because of boost::shared_ptr, and somewhat shabby access to the SWIG runtime.

Next version will use raw pointers, and a custom typesystem, so things will be much more flexible.