tjakal
07-10-2009, 09:11 AM
Hi, I'm a experienced max user but completly new to MAXscript. I have made a walkable firstperson cam and got the ground collision detection running using script controllers. Trouble I'm having is with my gravitation script;
if $meassure.pos.z > 25+$groundlevel.pos.z then
(
-(980*S^2) --fall speed. 9.8m/s squared
)
script works fine at the start but since "S" is a variabel constant (!?) it means the velocity of the fall increase forever. so if I walk of a ledge after walking around for a while, I instantly fall at a mindblowing speed.
Hence I tried;
if $meassure.pos.z > 25+$groundlevel.pos.z then
(
tempS = S --want this to store S's value once
V = S-TempS --time from start of fall
-(980*V^2) --fall speed. 9.8m/s squared
)
But it turns out this yields a value of zero and turns me into a flyer as 'tempS' effectivly becomes 'S' and increases with S. I guess it's something simple but I can't find the syntax or any forum posts on the subject?
-Thanks for reading!
if $meassure.pos.z > 25+$groundlevel.pos.z then
(
-(980*S^2) --fall speed. 9.8m/s squared
)
script works fine at the start but since "S" is a variabel constant (!?) it means the velocity of the fall increase forever. so if I walk of a ledge after walking around for a while, I instantly fall at a mindblowing speed.
Hence I tried;
if $meassure.pos.z > 25+$groundlevel.pos.z then
(
tempS = S --want this to store S's value once
V = S-TempS --time from start of fall
-(980*V^2) --fall speed. 9.8m/s squared
)
But it turns out this yields a value of zero and turns me into a flyer as 'tempS' effectivly becomes 'S' and increases with S. I guess it's something simple but I can't find the syntax or any forum posts on the subject?
-Thanks for reading!
