View Single Post
# 9 11-02-2014 , 03:20 PM
PixalZA's Avatar
Lifetime Member
Join Date: May 2011
Location: Riyadh, Saudi Arabia
Posts: 525
Here you go. Not elegant at all. The script assumes the geo is a square. The vertices are displaced along the y-axis of the object (Object space).
Select all the vertices and execute.
Code:
string   $allObjects[];
string   $obj;
float    $locwidth = 30.0;
float    $loclength = 30.0;
float    $xWaveCnt = 2.0;
float    $zWaveCnt = 2.0;
float    $amplitude = 2.0;
float    $displace;
float    $coords[];
float    $xOffset;
float    $zOffset;
float    $degreesX;
float    $degreesZ;
float    $xSin;
float    $zSin;
$allObjects = `ls -fl -selection`;

for ( $obj in $allObjects )
{
    $coords = `xform -q -os -t $obj`;
    $xOffset = $locwidth - $coords[0];
    $zOffset = $loclength - $coords[2];
    $degreesX = (360.0 * $xWaveCnt) * ($xOffset / $locwidth);
    $degreesZ = (360.0 * $zWaveCnt) - ((360.0 * $zWaveCnt) * ($zOffset / $loclength));
    $xSin = sin(deg_to_rad($degreesX));
    $zSin = sin(deg_to_rad($degreesZ));
    $displace = ($xSin * $zSin) * $amplitude;
    xform -os -r -t 0.0 $displace 0.0 $obj;
};


Earth: The crazy asylum of the universe.