Box2d b2EdgeChainDef and userData

BlitzMax Forums/Brucey's Modules/Box2d b2EdgeChainDef and userData

Armitage 1982(Posted 2009) [#1]
Hi Brucey

b2EdgeShape::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


Space_guy(Posted 2009) [#2]
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.


Armitage 1982(Posted 2009) [#3]
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()


Armitage 1982(Posted 2009) [#4]
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() :)


Armitage 1982(Posted 2009) [#5]
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 :)


Armitage 1982(Posted 2009) [#6]
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 ?