RailClone > RailClone Pro (*)

Transform segment along a spline

(1/2) > >>

Gabriel:
Hello,

I was wondering if there is a way to transform the same segment along a path. For example I would like its scale to be 100% at start but to get gradually smaller by the end of the spline. I have tried playing around with the plug in but I haven't managed to have success.

Thanks in advance

Paul Roberts:
Hi Gabriel,

To do this you would need to use an expression that will rescale the object based on it's position along the spline. To do this follow these steps.


* Create a new Transform operator and wire the it between the segment you wish to rescale and the generator
* Right click on the Transform operator and export the Fixed Scale X,Y, and Z properties
* Create a new Arithmetic node, wire it to the Transform  nodes exported scale parameters and set the mode to Expression
* Create a Numeric node for the start scale value and wire it to the Arithmetic nodes 1st input
* Create a second Numeric node and wire it to the Arithmetic node's second input. You will now have a graph like the image below. New nodes are shown in red


* Finally we need to add the expression. In the Arithmetic node, open the expression editor and enter:

(1-XSplinePosition)*Input1 + XSplinePosition*Input2

This expression is using the segment's position along the base spline to gradually transition between the start value (Input1) and the end value (Input2). XSplinePosition returns a scalar between 0.0 for the start of the spline and 1.0 at the end, so it can be used as a multiplier to gradually increase [ XSplinePosition*Input2] and decrease [(1-XSplinePosition)*Input1] values. By adding the two halves of the equation together we get a transition from one state to the next.

I hope that helps, please see the attached file for this example.

Many thanks!

Paul


To learn more about expressions, check out Chapter 3 of our new RailClone guide.

Gabriel:
Oh I see! Thanks a lot for your help Paul.   :D

Yuriy Bochkaryov:
Hello,
Is it possible to have more control points? Not only start and end, but some in the middle.
Thanks

Paul Roberts:
Hi,

Though it is possible, it's a little bit fiddly at the moment (see attached).



In future versions we hope to make this process simpler, possibly using transform markers placed along the spline.


Many thanks,

Paul

Navigation

[0] Message Index

[#] Next page

Go to full version