Back-story: I'm using blender as a level editor for a game I'm making, this means I write an addon in Python to export the relevant data in my format, and manipulate the blender interface to add options I need. Fixtures and Bodies (basically shapes) are easy to represent with 2D meshes, and I use Properties to add my specific options. Whenever I can, I exploit existing blender options (like the rigid body stuff) instead of adding my own. I am no avid blender user otherwise, so I guess that makes me a noob vs all everyday users.
[TL;DR: just read from here...]
What blender object resembles/represents Box2D Joints the best? And if none is perfect, what can I start with and how do I modify it to suit my needs?
I need it to have:
- Two "object properties" (references to other existing objects) which will represent which two bodies to connect. In Box2D these are called BodyA and BodyB.
- Two "point/vector" properties. These would represent what specific points on the two bodies to link together. Box2D name: AnchorA and AnchorB
What would also be nice:
- Have it visualize the joint between the two anchor points, if it draws a line or something that'd be great.
- Really nice if it actually restricted the objects to, say, a certain distance away from each other when I move them.
[...to here]
Then, I'm sure I could add more specific properties like joint type, break strength, etc. myself through Python Property registration.
Note: I am a programmer; I'm not afraid to code.
Oh, and before you mention it: I have seen "rigid body constraints", but among other things they don't satisfy condition 2. I've also found them generally messy and hard to understand (if the constraint is already applied to a body, what does it need two parent properties for?) I'm assuming a lot of this is because they are focused towards 3D not 2D, but am open for suggestions if someone still sees an opportunity there.
bpy.props.FloatVectorProperty()
it has default dimension of 3 but can be customized: blender.org/api/blender_python_api_2_67_1/bpy.props.html Yea I guess its not good to leave it all in comments, ill write the answer with some examples. $\endgroup$