ramiro3d

01-25-2009, 02:14 AM

What is the way to do a "Path Constraint" and a "LootAt constraint" via Expression Controllers, in order to avoid the built in Path and look at constraints?, Thanks.

View Full Version : MaxScript Question

ramiro3d 01-25-2009, 02:14 AM What is the way to do a "Path Constraint" and a "LootAt constraint" via Expression Controllers, in order to avoid the built in Path and look at constraints?, Thanks. |

eek

01-25-2009, 02:49 AM

I wouldnt use expressions, id use script controllers and script a curve in math, along with the matrix transformations needed to keep its twist correct down the curve.

ramiro3d

01-25-2009, 03:54 AM

I wouldnt use expressions, id use script controllers and script a curve in math, along with the matrix transformations needed to keep its twist correct down the curve.

Hi, Eek!, could you give me an example of a Script Controller to make an object follow a spline path?, i couldīt find how to solve it. thank you.

Hi, Eek!, could you give me an example of a Script Controller to make an object follow a spline path?, i couldīt find how to solve it. thank you.

wamo

01-25-2009, 04:07 AM

Hi, Eek!, could you give me an example of a Script Controller to make an object follow a spline path?, i couldīt find how to solve it. thank you.

Your answers in order to get the math solution are : Bezier curves, splines and interpolation.

Your answers in order to get the math solution are : Bezier curves, splines and interpolation.

gruhn

01-25-2009, 05:24 AM

I don't think you'd have to go learn all about spline math as suggested. Looks like this entry from the script reference indicates that it mayn't be too tough:

Shape Common Properties

lengthInterp <shape> [ <curve_num> ] <parameter> [ steps:<integer> ]

Return a point3 coordinate on the numbered curve (defaults to 1) corresponding to the

parameter value (0.0 to 1.0) that is that fraction along the curve's total length.

Shape Common Properties

lengthInterp <shape> [ <curve_num> ] <parameter> [ steps:<integer> ]

Return a point3 coordinate on the numbered curve (defaults to 1) corresponding to the

parameter value (0.0 to 1.0) that is that fraction along the curve's total length.

eek

01-25-2009, 07:09 AM

I don't think you'd have to go learn all about spline math as suggested. Looks like this entry from the script reference indicates that it mayn't be too tough:

Shape Common Properties

lengthInterp <shape> [ <curve_num> ] <parameter> [ steps:<integer> ]

Return a point3 coordinate on the numbered curve (defaults to 1) corresponding to the

parameter value (0.0 to 1.0) that is that fraction along the curve's total length.

LengthInterp is not uniform, as is the path constraint, depending on your setting. To have uniformalarity you'd have to determine the derivative of the lengthInterp.

But yes, you could use length interp. And also as a spline as a binormial tangent you have to deal with to figure out how to stop it flipping when it went round corners.

Shape Common Properties

lengthInterp <shape> [ <curve_num> ] <parameter> [ steps:<integer> ]

Return a point3 coordinate on the numbered curve (defaults to 1) corresponding to the

parameter value (0.0 to 1.0) that is that fraction along the curve's total length.

LengthInterp is not uniform, as is the path constraint, depending on your setting. To have uniformalarity you'd have to determine the derivative of the lengthInterp.

But yes, you could use length interp. And also as a spline as a binormial tangent you have to deal with to figure out how to stop it flipping when it went round corners.

gruhn

01-25-2009, 07:58 AM

Then

pathInterp <shape> [ <curve_num> ] <parameter>

Return a point3 coordinate on the numbered curve (defaults to 1) corresponding to the parameter value (0.0 to 1.0) that matches the 3ds Max Path controller percentage (vertex-based) interpolation

might do the job. I'm just saying look in the docs. Writing his own spline code is only likely to give the wrong results. I looked at that reply and said "Come on, Max has got to offer "evaluate spline at time t somehow."

pathInterp <shape> [ <curve_num> ] <parameter>

Return a point3 coordinate on the numbered curve (defaults to 1) corresponding to the parameter value (0.0 to 1.0) that matches the 3ds Max Path controller percentage (vertex-based) interpolation

might do the job. I'm just saying look in the docs. Writing his own spline code is only likely to give the wrong results. I looked at that reply and said "Come on, Max has got to offer "evaluate spline at time t somehow."

eek

01-25-2009, 04:51 PM

Im not doubting you, I used length interp & path interp for many ideas, projects and research - sometimes though you have to look further afield. A lot of the times i use math for curves is because i have complete control of firstly the interpolation, i.e i could blend from linear or cubic if i so chose or even nurbs mathmatically. Also i can full control of the tangent of the curve and the twist. Accessing max's nurbs curves is incredibly slow.

Even if you do use path Interp or length interp, which isnt a bad thing you'r have to figure out the tangent.

The other important thing is that if you want to over or undershoot the curve, your'll have to use math. This is important when building custom spline IKs that dont collapse when you bring the top closer to the bottom, instead it overshoots keeping the length.

Math curves arent that complex you just essentially blending multiple functions together.

Even if you do use path Interp or length interp, which isnt a bad thing you'r have to figure out the tangent.

The other important thing is that if you want to over or undershoot the curve, your'll have to use math. This is important when building custom spline IKs that dont collapse when you bring the top closer to the bottom, instead it overshoots keeping the length.

Math curves arent that complex you just essentially blending multiple functions together.

ramiro3d

01-26-2009, 03:15 AM

Ok, thank you guys, iīll keep trying and figuring out if itīs convinient or not. But itīs a very interesting subject to me, iīll keep studying more about maxscript and splines.

ramiro3d

01-27-2009, 03:16 AM

Ok, thats what i got, i drew a spline and created a Point Helper, on position controller i used a Position Script like this...

interpCurve3D $Line01 1 NT

interpCurve3D <splineShape> <spline_index> <param_float> [pathParam:<boolean>]

Returns a <point3> coordinate on the indexed curve. If pathParam:false, param is the fraction of the spline length, otherwise it is a segment-based (path) fraction. Default is pathParam:false

So this place the point helper over the spline and uses it like a path, but the percent is driver by the normalized time (NT), and i need to move it by dragging tehe gizmo, any idea?

interpCurve3D $Line01 1 NT

interpCurve3D <splineShape> <spline_index> <param_float> [pathParam:<boolean>]

Returns a <point3> coordinate on the indexed curve. If pathParam:false, param is the fraction of the spline length, otherwise it is a segment-based (path) fraction. Default is pathParam:false

So this place the point helper over the spline and uses it like a path, but the percent is driver by the normalized time (NT), and i need to move it by dragging tehe gizmo, any idea?

Polimeno

01-27-2009, 05:46 AM

Also i can full control of the tangent of the curve and the twist

Even if you do use path Interp or length interp, which isnt a bad thing you'r have to figure out the tangent.

The other important thing is that if you want to over or undershoot the curve, your'll have to use math. This is important when building custom spline IKs that dont collapse when you bring the top closer to the bottom, instead it overshoots keeping the length.

Math curves arent that complex you just essentially blending multiple functions together.

so, with this function is it possible to rigging , i.e an spine without flipping bones ??

can you show us some example about doing it right, please ?

ps:

and how do you determine a tangent of a spline ?

Even if you do use path Interp or length interp, which isnt a bad thing you'r have to figure out the tangent.

The other important thing is that if you want to over or undershoot the curve, your'll have to use math. This is important when building custom spline IKs that dont collapse when you bring the top closer to the bottom, instead it overshoots keeping the length.

Math curves arent that complex you just essentially blending multiple functions together.

so, with this function is it possible to rigging , i.e an spine without flipping bones ??

can you show us some example about doing it right, please ?

ps:

and how do you determine a tangent of a spline ?

ektho

01-28-2009, 10:51 AM

Hi Ramiro3D, look this.

http://www.3dmediatoonz.it/_stuff/ObjPathScriptTransform Max 2009.zip (http://www.3dmediatoonz.it/_stuff/ObjPathScriptTransform%20Max%202009.zip)

http://www.3dmediatoonz.it/_stuff/ObjPathScriptTransform Max 2009.zip (http://www.3dmediatoonz.it/_stuff/ObjPathScriptTransform%20Max%202009.zip)

Polimeno

01-28-2009, 11:21 PM

Hi Ramiro3D, look this.

http://www.3dmediatoonz.it/_stuff/ObjPathScriptTransform Max 2009.zip (http://www.3dmediatoonz.it/_stuff/ObjPathScriptTransform%20Max%202009.zip)

can you post in max 2008, please ?

http://www.3dmediatoonz.it/_stuff/ObjPathScriptTransform Max 2009.zip (http://www.3dmediatoonz.it/_stuff/ObjPathScriptTransform%20Max%202009.zip)

can you post in max 2008, please ?

CGTalk Moderation

01-28-2009, 11:21 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.