@react-three/rapier 0.12.1 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1054,7 +1054,13 @@ const Physics = ({
|
|
1054
1054
|
const clampedDelta = three.MathUtils.clamp(dt, 0, 0.2);
|
1055
1055
|
|
1056
1056
|
const stepWorld = () => {
|
1057
|
-
//
|
1057
|
+
// Apply attractors
|
1058
|
+
world.forEachRigidBody(body => {
|
1059
|
+
attractorStates.forEach(attractorState => {
|
1060
|
+
applyAttractorForceOnRigidBody(body, attractorState);
|
1061
|
+
});
|
1062
|
+
}); // Trigger beforeStep callbacks
|
1063
|
+
|
1058
1064
|
beforeStepCallbacks.forEach(callback => {
|
1059
1065
|
callback(api);
|
1060
1066
|
});
|
@@ -1075,22 +1081,18 @@ const Physics = ({
|
|
1075
1081
|
steppingState.accumulator += clampedDelta;
|
1076
1082
|
|
1077
1083
|
while (steppingState.accumulator >= _timeStep) {
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1084
|
+
// Set up previous state
|
1085
|
+
// needed for accurate interpolations if the world steps more than once
|
1086
|
+
if (_interpolate) {
|
1087
|
+
steppingState.previousState = {};
|
1088
|
+
world.forEachRigidBody(body => {
|
1083
1089
|
steppingState.previousState[body.handle] = {
|
1084
1090
|
position: body.translation(),
|
1085
1091
|
rotation: body.rotation()
|
1086
1092
|
};
|
1087
|
-
} // Apply attractors
|
1088
|
-
|
1089
|
-
|
1090
|
-
attractorStates.forEach(attractorState => {
|
1091
|
-
applyAttractorForceOnRigidBody(body, attractorState);
|
1092
1093
|
});
|
1093
|
-
}
|
1094
|
+
}
|
1095
|
+
|
1094
1096
|
stepWorld();
|
1095
1097
|
steppingState.accumulator -= _timeStep;
|
1096
1098
|
}
|
@@ -1054,7 +1054,13 @@ const Physics = ({
|
|
1054
1054
|
const clampedDelta = three.MathUtils.clamp(dt, 0, 0.2);
|
1055
1055
|
|
1056
1056
|
const stepWorld = () => {
|
1057
|
-
//
|
1057
|
+
// Apply attractors
|
1058
|
+
world.forEachRigidBody(body => {
|
1059
|
+
attractorStates.forEach(attractorState => {
|
1060
|
+
applyAttractorForceOnRigidBody(body, attractorState);
|
1061
|
+
});
|
1062
|
+
}); // Trigger beforeStep callbacks
|
1063
|
+
|
1058
1064
|
beforeStepCallbacks.forEach(callback => {
|
1059
1065
|
callback(api);
|
1060
1066
|
});
|
@@ -1075,22 +1081,18 @@ const Physics = ({
|
|
1075
1081
|
steppingState.accumulator += clampedDelta;
|
1076
1082
|
|
1077
1083
|
while (steppingState.accumulator >= _timeStep) {
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1084
|
+
// Set up previous state
|
1085
|
+
// needed for accurate interpolations if the world steps more than once
|
1086
|
+
if (_interpolate) {
|
1087
|
+
steppingState.previousState = {};
|
1088
|
+
world.forEachRigidBody(body => {
|
1083
1089
|
steppingState.previousState[body.handle] = {
|
1084
1090
|
position: body.translation(),
|
1085
1091
|
rotation: body.rotation()
|
1086
1092
|
};
|
1087
|
-
} // Apply attractors
|
1088
|
-
|
1089
|
-
|
1090
|
-
attractorStates.forEach(attractorState => {
|
1091
|
-
applyAttractorForceOnRigidBody(body, attractorState);
|
1092
1093
|
});
|
1093
|
-
}
|
1094
|
+
}
|
1095
|
+
|
1094
1096
|
stepWorld();
|
1095
1097
|
steppingState.accumulator -= _timeStep;
|
1096
1098
|
}
|
@@ -1029,7 +1029,13 @@ const Physics = ({
|
|
1029
1029
|
const clampedDelta = MathUtils.clamp(dt, 0, 0.2);
|
1030
1030
|
|
1031
1031
|
const stepWorld = () => {
|
1032
|
-
//
|
1032
|
+
// Apply attractors
|
1033
|
+
world.forEachRigidBody(body => {
|
1034
|
+
attractorStates.forEach(attractorState => {
|
1035
|
+
applyAttractorForceOnRigidBody(body, attractorState);
|
1036
|
+
});
|
1037
|
+
}); // Trigger beforeStep callbacks
|
1038
|
+
|
1033
1039
|
beforeStepCallbacks.forEach(callback => {
|
1034
1040
|
callback(api);
|
1035
1041
|
});
|
@@ -1050,22 +1056,18 @@ const Physics = ({
|
|
1050
1056
|
steppingState.accumulator += clampedDelta;
|
1051
1057
|
|
1052
1058
|
while (steppingState.accumulator >= _timeStep) {
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1059
|
+
// Set up previous state
|
1060
|
+
// needed for accurate interpolations if the world steps more than once
|
1061
|
+
if (_interpolate) {
|
1062
|
+
steppingState.previousState = {};
|
1063
|
+
world.forEachRigidBody(body => {
|
1058
1064
|
steppingState.previousState[body.handle] = {
|
1059
1065
|
position: body.translation(),
|
1060
1066
|
rotation: body.rotation()
|
1061
1067
|
};
|
1062
|
-
} // Apply attractors
|
1063
|
-
|
1064
|
-
|
1065
|
-
attractorStates.forEach(attractorState => {
|
1066
|
-
applyAttractorForceOnRigidBody(body, attractorState);
|
1067
1068
|
});
|
1068
|
-
}
|
1069
|
+
}
|
1070
|
+
|
1069
1071
|
stepWorld();
|
1070
1072
|
steppingState.accumulator -= _timeStep;
|
1071
1073
|
}
|