|
|
I have been fooling around with MegaPov a bit lately and I've come up
against a brick wall. I am trying to simulate the buoyant force of water,
but I can't find out how to make a field with Vector_Function() that is
dependent on the position of masses. So far all I've seen is the example
Vector_Function(function{0}function{-1}function{0}), which is a constant
downward force. My code so far is this:
Before the mechsim{...} block
#declare Fn_Vector = function(x,y,z) {
Vector_Function(
function{0}
function{
#if (y>RADIUS)
0
#else
#if (y<-RADIUS)
9.81*4/3
#else
9.81*pi*(((y-r)*r*r-1/3*pow(y-r,3))-(-r*r*r-1/3*pow(-r,3)))
#end
#end
}
function{0}
)
}
In the mechsim{...} block
field {
function {
Fn_Vector(x,y,z)
}
}
When I try to render it throws an error because it is treating the "y" in
the first #if as <0,1,0> and not the argument of the function. I have tried
replacing x, y, and z with a, b, and c, but then it claims that b is an
uninitialized identifier. What am I doing wrong? Thanks in advance!
Post a reply to this message
|
|