General Category > ASL Scripts

A new version of my water simulator script with more features!

<< < (3/3)

Claude:
Format of Anim8or .an8 Files:
https://www.anim8or.com/learn/specs/an8_format.txt

2020 Hindsight:
Hi Bayinghound,

Looking at the .an8 file for a saved mesh, it looks like it will be easy to create the mesh structures by directly writing to the file. I confess I haven't played with animation at all, so I don't know what the practical limits are. e.g. Ideally there would be a grid for every frame (so 90 meshes for your 3 second clip). Would that be too much for Anim8or/"morph targets" to handle?

If you are happy just to create the meshes then perhaps I could write a program in C that takes a .an8 file, looks for a wave object and replaces it with a number of mesh objects generated from the parameters in the wave object (the waves would look different to the script because I would be using a different random number generator). This feels like a dirty solution, and involves people trusting running my windows code, or knowing how to compile C for themselves.

Perhaps I can write a script to add an export waves option to Anim8or. Export scripts can write to files, and presumably have access to all the information I need.

I expect what you really want is to have it populate the sequence editor with X seconds of morph targets. If you could send me the Anim8or file for your animation so that I can crib from it, that would be a big help.

Thanks,
John

bayinghound:
Sure. I'll try and do it when I get home from work

2020 Hindsight:
Sorry I didn't get round to creating wave meshes for each frame.  But Steve had sent me a message indicating he hoped to soon start on implementing a proper solution for animated objects.

I see that he has now done this, or at least implemented a “preliminary version”:
https://www.anim8or.com/smf/index.php/topic,6051.0.html

This is much better than a hacked workaround from me.

I didn't pass the message on, because I didn’t want to raise expectations that Steve was going to deliver functionality, when it could have turned out that there was an unexpected complication meaning he had to ditch the feature.

Regards,
John

2020 Hindsight:
I added a function to place boat outlines in the water in a script I uploaded on:
https://www.anim8or.com/smf/index.php/topic,6051.0.html
I also posted a couple of YouTube links of the script in action.

/* Function: $addBoat( float $x, float $y, float $direction, float $length, float $width )
 *
 * x,y - Center of boat
 * direction - direction boat is pointing (in radians {radians=PI*degrees/180})
 * length - length of the boat
 * width - width of the boat
 */
int $addBoat( float $x, float $y, float $direction, float $length, float $width )
{
    $dx = sin($direction);
    $dy = cos($direction);
   
    for $angle = 0 to 2*PI step PI / (8 * ($length + $width)) do{
        $len_x = sin($angle) * $length;
        $len_y = cos($angle) * $width;

        $DecayingWaveOrigins.push( ($x + $len_x * $dy - $len_y * $dx,
                                    $y + $len_x * $dx + $len_y * $dy,
                                    1, 12) ); // amplitude, wave length
    }
    return 0;
}

The variable names are a bit odd because I was reusing variables I had already defined.

I should probably add amplitude and wave_length as function parameters!

Navigation

[0] Message Index

[*] Previous page

Go to full version