Physics: further box2d functionality

Post your work in progress addons and get feedback

Post » Mon Jul 14, 2014 9:34 pm

Hey all,

I am currently working to expose more of box2d's features to construct 2. I started with expanding the body types to include kinematic bodies and it is working.

However I have one problem. I can't seem to be able to read the new properties from the edit time or something like that. When I run the game and go into debug mode it says my property is "undefined". Any help or suggestions would be appreciated.

Also, if anyone is interested in this extended box2d functionality, let me know.
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,153

Post » Mon Jul 14, 2014 10:48 pm

Yes. Even when i'm not even sure what those are :) but it's always good to have more options.

Also if it's not too much trouble, could you check if it's possible to add create joint from position. When currently it is only possible from origin and image point.
B
34
S
9
G
3
Posts: 517
Reputation: 5,226

Post » Tue Jul 15, 2014 12:10 am

I've played with hacking on physics plugin. I found it useful to create joints between objects with picking by uid (if i'm right you can currently pick an object only in editor). it was simple but very useful edit, maybe you could implement something like that in your plugin.

Regarding edittime properties, please give more detail, not sure what's going on...
Be nice until it's time to not be nice
B
36
S
10
G
9
Posts: 293
Reputation: 6,712

Post » Tue Jul 15, 2014 11:35 pm

@JohnnySheffield - thats a good idea. As for details:

I basically have a new property declared in edittime.js I added it to the list of properties at the end. In Runtime I declare that this.myproperty = property_list[number of property in the list].

The problem is that my property is never set. I Essentially mirrored other code I saw, and changed appropriate values (such as the property in the list. If I hard code this.myproperty = x then it works. This is both my first time working in java and working on construct so it may take me a bit to get up to speed. I am sure I am missing something about what type I set the object and so on (my language knowledge is C++,VB,C#,Pascal)

@Katala - To my knowledge, you can't create a joint to an arbitrary vector. Box2d requires joints to be connected to two different bodies (box2d bodies, that is) so no matter how you put the joints together you will need a second body. I think I might know why you want to be able to hinge something without another body... it would be very useful...
Image
B
33
S
11
G
2
Posts: 564
Reputation: 5,153

Post » Wed Jul 16, 2014 9:26 am

I mean the object that creates the joint. Since I cannot change origin point or create/edit imagepoints at runtime. One way to achieve this would allow to use position where to create the joint instead.

Actually for my purposes I noticed that I can change the origin point of Yann's Polygon plugin. This seems to be good enough when I was thinking to make custom collision polygons with that anyway.
B
34
S
9
G
3
Posts: 517
Reputation: 5,226


Return to Work in Progress Addons

Who is online

Users browsing this forum: No registered users and 1 guest