General Category > ASL Scripts

PI is wrong?

(1/1)

Pirmin:
I have a Scene with 720 Frames where I want a vehicle to do a circle movement.
The Location controller looks like this.

--- Code: ---float $radius;
float $radian;

$radius = 450.0;
$radian = 2*PI * frame/720.0;  /* not reduced for clarity */

$position.y = 7.0;
$position.x = $radius * cos($radian);
$position.z = $radius * sin($radian);

--- End code ---
When I run this scene the vehicle does the circle movement but stops about 10 degrees before closing the circle! :'(

When I define an own variable $pi the vehicle moves the full circle.  ;)
Here is my modification.

--- Code: ---float $radius;
float $radian;
float $pi;

$pi = 3.1415926;
$radius = 450.0;
$radian = 2*$pi * frame/720.0;  /* not reduced for clarity */

$position.y = 7.0;
$position.x = $radius * cos($radian);
$position.z = $radius * sin($radian);

--- End code ---

Kubajzz:
What version of Anim8or are you using? The PI value should should be correct in v0.97d.

Pirmin:
Sorry, I had an old version (0.95c).
With the newest version it's OK.
Thank you!

Navigation

[0] Message Index

Go to full version