(def B2JointDefInterface)
| 247 | } |
| 248 | |
| 249 | func B2JointCreate(def B2JointDefInterface) B2JointInterface { // def should be back by pointer; a pointer is returned |
| 250 | |
| 251 | var joint *B2Joint = nil |
| 252 | |
| 253 | switch def.GetType() { |
| 254 | case B2JointType.E_distanceJoint: |
| 255 | { |
| 256 | if typeddef, ok := def.(*B2DistanceJointDef); ok { |
| 257 | return MakeB2DistanceJoint(typeddef) |
| 258 | } |
| 259 | |
| 260 | B2Assert(false) |
| 261 | } |
| 262 | |
| 263 | case B2JointType.E_mouseJoint: |
| 264 | { |
| 265 | if typeddef, ok := def.(*B2MouseJointDef); ok { |
| 266 | return MakeB2MouseJoint(typeddef) |
| 267 | } |
| 268 | |
| 269 | B2Assert(false) |
| 270 | } |
| 271 | |
| 272 | case B2JointType.E_prismaticJoint: |
| 273 | { |
| 274 | if typeddef, ok := def.(*B2PrismaticJointDef); ok { |
| 275 | return MakeB2PrismaticJoint(typeddef) |
| 276 | } |
| 277 | |
| 278 | B2Assert(false) |
| 279 | } |
| 280 | |
| 281 | case B2JointType.E_revoluteJoint: |
| 282 | { |
| 283 | if typeddef, ok := def.(*B2RevoluteJointDef); ok { |
| 284 | return MakeB2RevoluteJoint(typeddef) |
| 285 | } |
| 286 | |
| 287 | B2Assert(false) |
| 288 | } |
| 289 | |
| 290 | case B2JointType.E_pulleyJoint: |
| 291 | { |
| 292 | if typeddef, ok := def.(*B2PulleyJointDef); ok { |
| 293 | return MakeB2PulleyJoint(typeddef) |
| 294 | } |
| 295 | |
| 296 | B2Assert(false) |
| 297 | } |
| 298 | |
| 299 | case B2JointType.E_gearJoint: |
| 300 | { |
| 301 | if typeddef, ok := def.(*B2GearJointDef); ok { |
| 302 | return MakeB2GearJoint(typeddef) |
| 303 | } |
| 304 | |
| 305 | B2Assert(false) |
| 306 | } |
no test coverage detected