I need to get contact info of colliding bodies however it seems that it is not implemented in Gideros yet. I would like to write a C++plugin however i have not written a plugin for Gideros before and i wonder if it is possible to get the Box2D world state in the plugin and get the contact info (colliding points) out of it?
Thanks.
Comments
You'll need to take box2d source and than create a lua wrapper and compile as a plugin, which would be very tiresome, manageable, but I would not go that way without a deeper experience in C and Lua bridge.
Other options would be to do a pretty squeaky please to @atilim to wrap it and add in next Gideros version (which could take some time, because it's not a simple method of existing object, as most of the previous requests are, but it's a completely new object that needs to be implemented and wrapped).
Or @atilim could open source the box2d plugin, this way you'd only have to wrap contact list and recompile player with new plugin.
In the meantime, i am using raycast function continuously around my object (rectangle) to get contact info, not the best but i am able to get contact points this way. It is not pixel perfect but contact info is not pixel perfect either as long as your object is not bullet.
Thanks again.
For example if two bodies are circles, you can simply take both centers as vector and calculate the coordinates of vector which length equals radius of one circle
This is exactly my problem. I have a rope (a rectangle body) and it needs to wrap around the terrain. To wrap it (split it into to seperate rectangles) i need to get contact info. And when the collision ends, i need to join two splitted rectangles so it becomes one.
Here's some discussion on rope topic
http://www.giderosmobile.com/forum/discussion/2171/is-there-a-rope-joint-alternative/p1
In short, the particular reason for rectangle is the desired gameplay. Rope swinging left and right as a whole.
And if you implement your own setFixedRotation method while @atilim releases new version? Would it be too inefficient?
For each link in the chain (each rectangle) you can create two bodies, one with fixed rotation other without. Set without fixed rotation body as inactive, so it does not consume any processing.
And then when you need to change fixed rotation, simply switch the bodies by setting on as active and other as inactive and copying their positions.
Just an idea
Likes: ar2rsawseen
BTW distance joint is used to limit minimal distance and rope joint to limit maximal distance.
@arturs i will try to make a video of my problem and send it to you today.