# How to create a center curve from points

## Recommended Posts

I'm watching dragon 2's ice blast system breakdown

I got confuse about how to create center curve and custom velocity

##### Share on other sites

Here's one way to define a spine curve along a spray of particles that have been hit.

-store the hit time as @firsttime

-normalise that, store it as @u

-quantize @u to the amount of points you want along the curve. now there's patches of points that share the same @u

-add prims by attribute @u, now you have little polyline islands that have the same @u value

-promote the average @P to prim, then back down as @Pavg

-set @P as @Pavg, fuse. Now each island has been collapsed to a single point at its average center

-sort these points by @firsttime so they're in order

-add prim, this will make the line

-smooth

pop_curve_center.hipnc

Edited by mestela
##### Share on other sites

Here's one way to define a spine curve along a spray of particles that have been hit.

-store the hit time as @firsttime

-normalise that, store it as @u

-quantize @u to the amount of points you want along the curve. now there's patches of points that share the same @u

-add prims by attribute @u, now you have little polyline islands that have the same @u value

-promote the average @P to prim, then back down as @Pavg

-set @P as @Pavg, fuse. Now each island has been collapsed to a single point at its average center

-sort these points by @firsttime so they're in order

-add prim, this will make the line

-smooth

wow!Thank you very much!

It's perfect!

##### Share on other sites

Here's one way to define a spine curve along a spray of particles that have been hit.

-store the hit time as @firsttime

-normalise that, store it as @u

-quantize @u to the amount of points you want along the curve. now there's patches of points that share the same @u

-add prims by attribute @u, now you have little polyline islands that have the same @u value

-promote the average @P to prim, then back down as @Pavg

-set @P as @Pavg, fuse. Now each island has been collapsed to a single point at its average center

-sort these points by @firsttime so they're in order

-add prim, this will make the line

-smooth

sorry for bothering you again.

How can i use this center curve to define the vector like the picture 2.

##### Share on other sites

You can compare the average Position with your current P and then if its "x" or "z" values are greater or smaller go one way or the other.

##### Share on other sites

-set each point normal to {0,1,0}

-get closest point on the curve (a)

-get the next point on the curve (a+1)

-vector along the curve is b - a

-vector away from the curve for each point is a - @P

-add those vectors to @N, scale to taste

would need further refining no doubt, but that's the general idea.

pop_curve_center_normal.hipnc

Edited by mestela
##### Share on other sites

-set each point normal to {0,1,0}

-get closest point on the curve (a)

-get the next point on the curve (a+1)

-vector along the curve is b - a

-vector away from the curve for each point is a - @P

-add those vectors to @N, scale to taste

would need further refining no doubt, but that's the general idea.

wow! thank you very much!

you rock!

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×