summaryrefslogtreecommitdiff
path: root/frontend/_rigidbody/rigidbody_1.js
diff options
context:
space:
mode:
authorMatthew Kosarek <mattkae@protonmail.com>2021-02-07 19:22:56 -0500
committerMatthew Kosarek <mattkae@protonmail.com>2021-02-07 19:22:56 -0500
commitcc6d3871008a89fcf48814596d7bfec05f2706e4 (patch)
tree993ce66cc5a3c96841dc52fea60df873ff2f3469 /frontend/_rigidbody/rigidbody_1.js
parent376e1a7f9207fffb1ec3027ac1e7f32db5de4922 (diff)
Added rotational dynamics to the examples
Diffstat (limited to 'frontend/_rigidbody/rigidbody_1.js')
-rw-r--r--frontend/_rigidbody/rigidbody_1.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/frontend/_rigidbody/rigidbody_1.js b/frontend/_rigidbody/rigidbody_1.js
index 5021162..c5e4f0a 100644
--- a/frontend/_rigidbody/rigidbody_1.js
+++ b/frontend/_rigidbody/rigidbody_1.js
@@ -72,9 +72,17 @@ function main() {
ev.preventDefault();
ev.stopPropagation();
- const lXValue = $(this).find('.vec2_x_input').val(),
+ let lXValue = $(this).find('.vec2_x_input').val(),
lYValue = $(this).find('.vec2_y_input').val();
+ if (lXValue.length === 0) {
+ lXValue = 0;
+ }
+
+ if (lYValue.length === 0) {
+ lYValue = 5000;
+ }
+
console.log('Applying force: ' + lXValue + ', ' + lYValue);
lCircle.force = addVec2(lCircle.force, vec2(Number(lXValue), Number(lYValue)));
}