Itoo Software Forum

RailClone => RailClone Pro (*) => RailClone Pro Beta => Topic started by: Dragan on October 15, 2021, 04:47:59 PM

Title: 5.0.1 Banking issue
Post by: Dragan on October 15, 2021, 04:47:59 PM
Please check the scene file. It seems that the Banking position has no effect and the Subspline is also affected.
It would be nice if Banking can be dependent on the SubSpline order like Markers.
Also, it would be nice if we can have Spline Position/Angle as User Data parameters.
btw. Markers are working as expected.
Title: Re: 5.0.1 Banking issue
Post by: iToo on October 18, 2021, 11:35:57 AM
This is a bug. Banking is not handled correctly by sub-spline, as it should.
I already fixed for next update.

Banking value can be used on expressions using: XSplineXDirection, XSplineYDirection, XSplineZDirection.
XSplineXDirection is the tangent vector over the spline, XSplineZDirection is the up vector, and XSplineYDirection perpendicular to both.

Banking angle can be computed from vectors using this expression:

# Banking angle to local XY plane. Limited to [-180,180] (0 = vertical)
vector z0 = [0, 0, 1];
vector vz = XSplineZDirection;
real angle = radToDeg(atan2(length(crossprod(z0, vz)), z0 * vz));
return angle;

I've attached a (completely useless) example, where Segment Z size is proportional to the banking angle.

Title: Re: 5.0.1 Banking issue
Post by: Dragan on October 18, 2021, 11:55:16 AM
 :D ;)
Thank you Carlos.
It will be tricky for newbie users to get all those expressions especially because they can easily manipulate with Angle at Modifier state but back in the expressions they need to think about vectors, spline directions, etc.
If you'll be able to add expression attributes like `Banking Angle[0]=40 deg` to match the Banking modifier order/angle it would be great.
I know it is a huge task but even without improving anything for expression, Banking is really nice feature as it is. Just those few bugs to be solved and I think it is ready for production. I guess 99% of Users will use this feature via viewport.  ;)
Title: Re: 5.0.1 Banking issue
Post by: iToo on October 19, 2021, 12:27:44 PM
I was not sure what would be more useful at expressions, vectors or angle. But yes, finally i will add both.

Please note these attributes doesn't return the value you set at RCSpline, but the final vector/rotation angle is applied to each segment. That includes interpolated Banking + Generator->X Rotation.