Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rotation anchors
#1
Photo 
I just bought the latest Curvy and have been trying to get an effect from a flat CG extrusion.  I would like the X-axis of the extrusion to always remain parallel to the X-Z plane. The spline does not stay in this plane but can vary in Y. I wish to prevent the X-axis (side to side of the extrusion) to not bank.

I can not figure out a way to use the Orientation Anchors and / or Spline Orientation mode to make this happen. 

In the image I've included, the CP at the top of the curve should have the orientation vector pointing straight up as an example.

Any suggestions or solutions to make this happen?


Attached Files Thumbnail(s)
   
Reply
#2
Hi
Can you send me please a simple schematisation of what result mesh extrusion you are expecting?
Thanks
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply
#3
Ok... I think I figured it out. I need to set the Spline.Orientation to static and then make sure the Z-rotation of the CP's are set to 0.

I want the flat spline path to stay  parallel to the ground plane (XZ), not to bank, even if the spline all over the place. 
For example, old "Slinky" toy was a flat spiral. Or a road twisting through the mountains (assuming they don't try to bank the curves for speed) is best flat, side-to-side across the road.

I will code this to see if this does it. If you know of a better or more proper way, please suggest.
Reply
#4
Ok... I think I figured it out. I need to set the Spline.Orientation to static and then make sure the Z-rotation of the CP's are set to 0.

I want the flat spline path to stay  parallel to the ground plane (XZ), not to bank, even if the spline all over the place. 
For example, old "Slinky" toy was a flat spiral. Or a road twisting through the mountains (assuming they don't try to bank the curves for speed) is best flat, side-to-side across the road.

I will code this to see if this does it. If you know of a better or more proper way, please suggest.


Code:
        Vector3 localFinalPos = trackSpline.transform.InverseTransformPoint( worldPos );
        var cp = trackSpline.Add( localFinalPos, Space.World );
        var euler = cp.transform.rotation.eulerAngles;
        cp.SetRotation( Quaternion.Euler( euler.x, euler.y, 0 ) );
Seems to work!!
Reply
#5
Hi
I didn't dig into your code, since it gave you the result you wanted. Feel free to write me if you have any other issue.
If and when you feel like it, please leave a review for the asset, that helps a lot.
Have a nice day
Please consider leaving a review for Curvy. This will help a lot keeping Curvy relevant in the eyes of the Asset Store algorithm.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Align to spline action and rotation Lupp_ 3 1,341 01-23-2021, 08:12 PM
Last Post: _Aka_
  Rotation of Curvy Spline Segment jh092 1 1,348 05-31-2020, 09:36 AM
Last Post: _Aka_
Photo Rotation Scatter Cherub 2 1,585 05-05-2020, 08:25 PM
Last Post: Cherub
  Look rotation viewing vector is zero skyboard 6 7,553 12-02-2019, 06:53 PM
Last Post: _Aka_

Forum Jump: