@@ -69,8 +69,8 @@ VelocityPair GetVelocityDelta(const VelocityConstraint& vc, const Momentum2 impu
6969{
7070 assert (IsValid (impulses));
7171
72- const auto bodyA = &bodies[vc.GetBodyA (). get ( )];
73- const auto bodyB = &bodies[vc.GetBodyB (). get ( )];
72+ const auto bodyA = &bodies[to_underlying ( vc.GetBodyA ())];
73+ const auto bodyB = &bodies[to_underlying ( vc.GetBodyB ())];
7474 const auto normal = vc.GetNormal ();
7575
7676 const auto invRotInertiaA = bodyA->GetInvRotInertia ();
@@ -99,8 +99,8 @@ Momentum BlockSolveUpdate(VelocityConstraint& vc, const Momentum2 newImpulses,
9999 std::vector<BodyConstraint>& bodies)
100100{
101101 const auto delta_v = GetVelocityDelta (vc, newImpulses - GetNormalImpulses (vc), bodies);
102- const auto bodyA = &bodies[vc.GetBodyA (). get ( )];
103- const auto bodyB = &bodies[vc.GetBodyB (). get ( )];
102+ const auto bodyA = &bodies[to_underlying ( vc.GetBodyA ())];
103+ const auto bodyB = &bodies[to_underlying ( vc.GetBodyB ())];
104104 bodyA->SetVelocity (bodyA->GetVelocity () + std::get<0 >(delta_v));
105105 bodyB->SetVelocity (bodyB->GetVelocity () + std::get<1 >(delta_v));
106106 SetNormalImpulses (vc, newImpulses);
@@ -280,8 +280,8 @@ inline Momentum BlockSolveNormalConstraint(VelocityConstraint& vc,
280280 const auto b_prime = [&bodies,&vc]() {
281281 const auto normal = vc.GetNormal ();
282282
283- const auto velA = bodies[vc.GetBodyA (). get ( )].GetVelocity ();
284- const auto velB = bodies[vc.GetBodyB (). get ( )].GetVelocity ();
283+ const auto velA = bodies[to_underlying ( vc.GetBodyA ())].GetVelocity ();
284+ const auto velB = bodies[to_underlying ( vc.GetBodyB ())].GetVelocity ();
285285 const auto ra0 = vc.GetPointRelPosA (0 );
286286 const auto rb0 = vc.GetPointRelPosB (0 );
287287 const auto ra1 = vc.GetPointRelPosA (1 );
@@ -338,8 +338,8 @@ inline Momentum SeqSolveNormalConstraint(VelocityConstraint& vc,
338338
339339 const auto direction = vc.GetNormal ();
340340 const auto count = vc.GetPointCount ();
341- const auto bodyA = &bodies[vc.GetBodyA (). get ( )];
342- const auto bodyB = &bodies[vc.GetBodyB (). get ( )];
341+ const auto bodyA = &bodies[to_underlying ( vc.GetBodyA ())];
342+ const auto bodyB = &bodies[to_underlying ( vc.GetBodyB ())];
343343
344344 const auto invRotInertiaA = bodyA->GetInvRotInertia ();
345345 const auto invMassA = bodyA->GetInvMass ();
@@ -398,8 +398,8 @@ inline Momentum SolveTangentConstraint(VelocityConstraint& vc,
398398 const auto friction = vc.GetFriction ();
399399 const auto tangentSpeed = vc.GetTangentSpeed ();
400400 const auto count = vc.GetPointCount ();
401- const auto bodyA = &bodies[vc.GetBodyA (). get ( )];
402- const auto bodyB = &bodies[vc.GetBodyB (). get ( )];
401+ const auto bodyA = &bodies[to_underlying ( vc.GetBodyA ())];
402+ const auto bodyB = &bodies[to_underlying ( vc.GetBodyB ())];
403403
404404 const auto invRotInertiaA = bodyA->GetInvRotInertia ();
405405 const auto invMassA = bodyA->GetInvMass ();
@@ -498,8 +498,8 @@ d2::PositionSolution SolvePositionConstraint(const d2::PositionConstraint& pc,
498498 assert (IsValid (conf.linearSlop ));
499499 assert (IsValid (conf.maxLinearCorrection ));
500500
501- const auto bodyA = &bodies[pc.GetBodyA (). get ( )];
502- const auto bodyB = &bodies[pc.GetBodyB (). get ( )];
501+ const auto bodyA = &bodies[to_underlying ( pc.GetBodyA ())];
502+ const auto bodyB = &bodies[to_underlying ( pc.GetBodyB ())];
503503
504504 const auto invMassA = moveA? bodyA->GetInvMass (): InvMass{0 };
505505 const auto invRotInertiaA = moveA? bodyA->GetInvRotInertia (): InvRotInertia{0 };
0 commit comments