Answer the question
In order to leave comments, you need to log in
How to write a mat formula or reduce the number of conditions?
Good evening everyone. I had such a problem.
There is an object which has a property "size". The initial size is 0.1. Depending on the size, I change its movement speed.
The speed changes when the size has not reached the new value.
2.5 - 0.1;
5 - 0.2;
7.5 - 0.3;
10 - 0.4;
12.5 - 0.5;
15 - 0.6;
17.5 - 0.7;
20 - 0.8;
22.5 - 0.9;
25 - 1;
where 2.5 is the size and 0.1 is the speed.
So if you write all this in the form of conditions, then there is a lot of code, but is it possible to somehow reduce this? That is, in order to understand whether the size has reached 2.5 or 7.5 or 15 or 17.5, and depending on this, change the speed.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question