I know two ways to rotate an object(see below). Which one is better/faster to use?
Use math module to convert to radians and the to_matrix or manual calculation without the module and set the orientation directly?
First define “better”.
Then think about the different topics. What do you think, which one should be faster/better (What is your expectation)?
Now do a benchmark test to see what it is (e.g. calculate 10000 times with one method compared to the other method).
I assume the same, this is 99% of the time true calling a predefined function is faster…but I am curious if you test the ‘time’ it takes…please share your results.
Yup, and don’t complain if you don’t know why i’m doing it.
First define “better”.
Python’s math module is running c functions under the hood, so despite the trivial processing, using the standard lib will be faster 99% of the time
Well, better would not be a thing due to they both do the same, i just wondered if it would be faster to manual calculate or by importing the math module, i always thought that modules also took time to process.
I also read somewhere that if you imported modules (probably bge) script would become gpl. So that’s why i also was thinking about manual vs module.
I don’t know what you expected: math.radians is almost 2x faster than a Python equivalent. C for the win !
Hmm, wanted to do some testing today, so i’m glad that you already did it. That is actually quite a lot, did not expect it to be 2 times faster.