How do I do math in gameblender python? I am well versed in VB. Do any cross reference tutorials exist to help me make this transitiion? (sorry for the newbieness of this question)
what kind of math are you trying to do?
also, have you checked the python docs for ā¦ python?
Very simpleā¦
import math
Rad = 50
X = sin(rad)
Deg = math.degrees(asin(X))
A = 5
B = 7
A+B = 12
A*B = 35
A/B = 0.71428571428571428571428571428571
And a math function:
import math
def PlayWithMyNumber(Number):
Number=Number+5
Number=Number-math.sin(Number)
Number=Number*3
Number=Number/Number
return Number
A = 7
B=PlayWithMyNumber(A)
print B
#Output is: 1.0000000000
Anything else?
You can do a: āfrom math import *ā instead of āimport mathā if you donāt like doing math.sin, math.x, etcā¦ if you do āfrom math import *ā than you can just do: sin(a), degrees(a), etcā¦
Enjoy.
And for more tuts: www.python.org
or: www.google.com
The stupid forum gives you the [ code ] [ / code ] tags so you can do things like that:
import math
def PlayWithMyNumber(Number):
Number=Number+5
Number=Number-math.sin(Number)
Number=Number*3
Number=Number/Number
return Number
%|
Martin
The stupid forum gives you the [ code ] [ / code ] tags so you can do things like that:
import math
def PlayWithMyNumber(Number):
Number=Number+5
Number=Number-math.sin(Number)
Number=Number*3
Number=Number/Number
return Number
%|
Martin[/quote]
%| Whoops! My badā¦