Essentially, I want to adjust the size of my mesh along the x-axis by adding "1" when a radio button is checked. If the radio button is unchecked, I want to reverse this action.
Usually, I would achieve this by setting the x-axis size as follows:
Something like:
If the radio button is checked
mesh.scale.x = 2;
If the radio button is unchecked
mesh.scale.x = 1;
The challenge in my case arises from the variable scale level of my mesh due to other factors. It's possible that the x-axis scale level might not be "1", but instead something like "3.7".
Given that the above approach doesn't work for me, I'm seeking a mathematical solution that can simply add and subtract "1" from the mesh.
$('input').change(function () {
if ($('#radio1').is(":checked")) {
mesh.scale.x += 1;
}
if ($('#radio2').is(":checked")) {
mesh.scale.x += 2;
}
});
The issue with my current function is that it adds the value onto the previous value each time. Ideally, I'm looking for a solution that subtracts the previous value before adding a new one.