Skip to content

Commit 64f891c

Browse files
NArnottcodingben
authored andcommitted
Add use of FrictionJointDef and throw exception if specific JointDef is not yet implemented
1 parent 023fd83 commit 64f891c

File tree

1 file changed

+14
-10
lines changed
  • src/box2dx/Box2D.NetStandard/Dynamics/Joints

1 file changed

+14
-10
lines changed

src/box2dx/Box2D.NetStandard/Dynamics/Joints/Joint.cs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,13 @@ Box2DX Copyright (c) 2009 Ihar Kalasouski http://code.google.com/p/box2dx
2525
// SOFTWARE.
2626
*/
2727

28+
using System;
2829
using System.Numerics;
2930
using System.Runtime.CompilerServices;
3031
using Box2D.NetStandard.Common;
3132
using Box2D.NetStandard.Dynamics.Bodies;
3233
using Box2D.NetStandard.Dynamics.Joints.Distance;
34+
using Box2D.NetStandard.Dynamics.Joints.Friction;
3335
using Box2D.NetStandard.Dynamics.Joints.Gear;
3436
using Box2D.NetStandard.Dynamics.Joints.Mouse;
3537
using Box2D.NetStandard.Dynamics.Joints.Prismatic;
@@ -192,16 +194,18 @@ public static void AngularStiffness(
192194
internal static Joint Create(JointDef def)
193195
{
194196
return def switch
195-
{
196-
DistanceJointDef d => new DistanceJoint(d),
197-
MouseJointDef d => new MouseJoint(d),
198-
PrismaticJointDef d => new PrismaticJoint(d),
199-
RevoluteJointDef d => new RevoluteJoint(d),
200-
PulleyJointDef d => new PulleyJoint(d),
201-
GearJointDef d => new GearJoint(d),
202-
WheelJointDef d => new WheelJoint(d),
203-
WeldJointDef d => new WeldJoint(d)
204-
};
197+
{
198+
DistanceJointDef d => new DistanceJoint(d),
199+
MouseJointDef d => new MouseJoint(d),
200+
PrismaticJointDef d => new PrismaticJoint(d),
201+
RevoluteJointDef d => new RevoluteJoint(d),
202+
PulleyJointDef d => new PulleyJoint(d),
203+
GearJointDef d => new GearJoint(d),
204+
WheelJointDef d => new WheelJoint(d),
205+
WeldJointDef d => new WeldJoint(d),
206+
FrictionJointDef d => new FrictionJoint(d),
207+
_ => throw new NotImplementedException($"JointDef '{def.GetType().Name}' is not implemented.")
208+
};
205209
}
206210

207211
internal abstract void InitVelocityConstraints(in SolverData data);

0 commit comments

Comments
 (0)