@@ -194,7 +194,7 @@ void Create(int index)
194194 m_bodyIds [ m_bodyIndex ] = b2CreateBody ( m_worldId , bodyDef ) ;
195195
196196 B2ShapeDef shapeDef = b2DefaultShapeDef ( ) ;
197- shapeDef . userData = m_userData [ m_bodyIndex ] ;
197+ shapeDef . userData = B2UserData . Ref ( m_userData [ m_bodyIndex ] ) ;
198198 m_userData [ m_bodyIndex ] . ignore = false ;
199199 if ( m_bodyIndex == m_ignoreIndex )
200200 {
@@ -560,7 +560,7 @@ static float RayCastClosestCallback(in B2ShapeId shapeId, B2Vec2 point, B2Vec2 n
560560 {
561561 CastContext rayContext = ( CastContext ) context ;
562562
563- ShapeUserData userData = ( ShapeUserData ) b2Shape_GetUserData ( shapeId ) ;
563+ ShapeUserData userData = b2Shape_GetUserData ( shapeId ) . GetRef < ShapeUserData > ( ) ;
564564
565565 // Ignore a specific shape. Also ignore initial overlap.
566566 if ( ( userData != null && userData . ignore ) || fraction == 0.0f )
@@ -588,7 +588,7 @@ static float RayCastAnyCallback(in B2ShapeId shapeId, B2Vec2 point, B2Vec2 norma
588588 {
589589 CastContext rayContext = ( CastContext ) context ;
590590
591- ShapeUserData userData = ( ShapeUserData ) b2Shape_GetUserData ( shapeId ) ;
591+ ShapeUserData userData = b2Shape_GetUserData ( shapeId ) . GetRef < ShapeUserData > ( ) ;
592592
593593 // Ignore a specific shape. Also ignore initial overlap.
594594 if ( ( userData != null && userData . ignore ) || fraction == 0.0f )
@@ -618,7 +618,7 @@ static float RayCastMultipleCallback(in B2ShapeId shapeId, B2Vec2 point, B2Vec2
618618 {
619619 CastContext rayContext = ( CastContext ) context ;
620620
621- ShapeUserData userData = ( ShapeUserData ) b2Shape_GetUserData ( shapeId ) ;
621+ ShapeUserData userData = b2Shape_GetUserData ( shapeId ) . GetRef < ShapeUserData > ( ) ;
622622
623623 // Ignore a specific shape. Also ignore initial overlap.
624624 if ( ( userData != null && userData . ignore ) || fraction == 0.0f )
@@ -652,7 +652,7 @@ static float RayCastSortedCallback(in B2ShapeId shapeId, B2Vec2 point, B2Vec2 no
652652 {
653653 CastContext rayContext = ( CastContext ) context ;
654654
655- ShapeUserData userData = ( ShapeUserData ) b2Shape_GetUserData ( shapeId ) ;
655+ ShapeUserData userData = b2Shape_GetUserData ( shapeId ) . GetRef < ShapeUserData > ( ) ;
656656
657657 // Ignore a specific shape. Also ignore initial overlap.
658658 if ( ( userData != null && userData . ignore ) || fraction == 0.0f )
0 commit comments