Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Box 2d: object selection.

Author
Message
z i l c h vortex
18
Years of Service
User Offline
Joined: 20th Feb 2007
Location: united kingdom
Posted: 15th Oct 2009 17:56
Im making a 2d sandbox and i have got quite far just hit a brick wall how do you get the object code for one of the objects in box 2d.

Thank you.

life is short but so am i
Cybermind
Valued Member
22
Years of Service
User Offline
Joined: 28th Nov 2002
Location: Denmark
Posted: 15th Oct 2009 19:57
Could you be more specific?

The byte chrunchers are coming...
z i l c h vortex
18
Years of Service
User Offline
Joined: 20th Feb 2007
Location: united kingdom
Posted: 15th Oct 2009 23:18
yea in box2d the physics plugin cause you use templates and you dont assign them by a number how do you make it so you can get some sort of object i.d to call them by.

life is short but so am i
Diggsey
19
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 16th Oct 2009 02:00 Edited at: 16th Oct 2009 02:02
When you create a body from a template, the creation function returns an ID. This is the same as any DBPro ID, except that the plugin chooses a free ID automatically for you. You can use this ID to reference the body from then on, until it is destroyed.

edit:
If you mean how to get the body under the mouse, look at the 'contact listener' example on the wiki: http://diggsey.heliohost.org/box2d/wiki/index.php?title=Sample_Contact_Listener

It shows you how to select an object when the user clicks, and uses a mouse joint to drag it around.

z i l c h vortex
18
Years of Service
User Offline
Joined: 20th Feb 2007
Location: united kingdom
Posted: 16th Oct 2009 03:38
The server is down

life is short but so am i
Diggsey
19
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 17th Oct 2009 01:11
z i l c h vortex
18
Years of Service
User Offline
Joined: 20th Feb 2007
Location: united kingdom
Posted: 17th Oct 2009 03:16
Thank you diggsey ill try base around thank you.

life is short but so am i

Login to post a reply

Server time is: 2025-06-17 05:41:39
Your offset time is: 2025-06-17 05:41:39