Box2d b2EdgeChainDef and userData
BlitzMax Forums/Brucey's Modules/Box2d b2EdgeChainDef and userData
| ||
Hi Bruceyb2EdgeShape::SetUserData(obj:Object) or ShapeDef.userData = obj b2EdgeShape(Body.CreateShape(ShapeDef)) Doesn't seem to be available for GetUserData() while retrieving shape inside a ContactPoint object. Normally the 2 shapes colliding are accessible from a b2ContactListener but EdgeShape miss the userdata option present in any other body/shape... Also I'm wondering if missing bbdoc bloc around SetIsALoop() or IsALoop() explain why those keywords isn't highlighted like any other methods in Blide ? Would it be possible to have a look at this ? It's a missing key for a large amount of features with EdgeShape objects in my engine. Thanks |
| ||
As I remember the edgeshape itself uses the userdata to keep track of the next segment of the shape. So you might want to code around that. |
| ||
Thanks for the tip Space_guy. Won't be a piece of cake to work around this one since b2ContactPoint only work with shapes. Maybe with b2ContactPoint.GetShape1().GetBody().GetUserData() |
| ||
Nope :( EdgeShape also wipe my body.userData with his own. The strange thing is that userData of every shapes is replaced with Null and the body one with something else. I see no way outofthebox to link an object to this kind of shape except maybe by deep modifying the process that nullify userdata :( EDIT Ok it's working, just be sure it is shape1 or shape2 that sending the contactpoint before asking the userdata of the shape.getbody() :) |
| ||
Oh and about Box2d : I think it would be a great idea to add setX(x:float) and setY(y:float) to b2vec2 type because there is only a set(x:float,y:float) method. Of course this can be easily added but would be nice to get this out of the box :) |
| ||
maybe Rem bbdoc: Sets the x parts. End Rem Method SetX(x:Float) bmx_b2vec2_set(b2ObjectPtr, x, self.GetY()) End Method Rem bbdoc: Sets the y parts. End Rem Method SetY(y:Float) bmx_b2vec2_set(b2ObjectPtr, self.GetX(), y) End Method to box2d.bmx ? |