This script is VERY basic at this point. For the first step, I'm just looking to more or less duplicate the effect of a renderable spline.

Right now, what I have works generally well for a spline with only minor deviations from a straight path, but anything too loopy and it starts to twist. I've included some code to make a couple example splines. For debugging purposes, I'm having it create point helpers at the places where the mesh vertices will be. Right now I'm looking for suggestions for making the points be non-twisted.

for s in splineKnotPosArray do -- for each spline
(
for i = 1 to s.count do -- for the position of each knot in the spline
(
normalArray = #()

-- Get the vectors between each point, and the preceding and following points
if i != 1 do append normalArray (normalize (s[i] - s[i - 1]))
if i != s.count do append normalArray (normalize (s[i + 1] - s[i]))

simply (and temporary) create shape's mesh using render_displayRenderMesh flag.
#if you know number of render_sides you know number of loops
#get average plane for every loop
#average normal of the plane gives you the UP vector
#vector from loop's average center to vertex with lowest index gives you SIDE vector
#to get plane's transform is trivial: PSEUDO (matrix3 (cross SIDE UP) SIDE UP CENTER)

that all that you need

CGTalk Moderation

11-28-2011, 04:46 PM

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.

Follow Us On:

The CGSociety

The CGSociety is the most respected and accessible global organization for creative digital artists. The CGS supports artists at every level by offering a range of services to connect, inform, educate and promote digital artists worldwide. More about us