← Back to list

Zip Lines — Fixing Rotation and End Position

Alright, let’s fix that rotation issue. I’ve done this before, when mounting the zip line. Except… that code is missing right now. Did I…

Sean Duggan · 2026-05-08 05:30 · 0 claps · 1.7 min read
#unity #ziplines #unity-splines #spline
Open on Medium ↗
Wiki topics: 3D · Motion & 3D Design 🎮 · Gaming

Zip Lines — Fixing Rotation and End Position

[embed]Spline 2 — The Rereticulation OK, so I plugged all of my code in last night for the splines… and it’s not working the way that I expect.medium.com

Alright, let’s fix that rotation issue. I’ve done this before, when mounting the zip line. Except… that code is missing right now. Did I accidentally remove it? Well, it’s an easy enough fix. So long as we’ve done our EvaluatePosition call, we have a forward and an up vector for the Spline. We can toss that into a Rotation.LookRotation function to get the Quaternion.

Quaternion orientation = Quaternion.LookRotation(forward, up);

One catch? That’s the rotation for the zip line, but we actually kind of want the character to hang downwards for now, even when the zip line is tipped off the horizontal, so we’ll just want to get the Y rotation. This ought to do it.

orientation = Quaternion.Euler(0, orientation.eulerAngles.y, 0);

Then, we can either snap that rotation into place, or provide a RotateTowards call so that it eases into it. Let’s snap into it initially.

transform.rotation = orientation;

Now, there was a bit of initial error in my code for this. First of all, the rotation wasn’t changing as the spline did, in part because my loop didn’t keep calling EvaluatePoint, so the forward and up vectors never changed. Secondly, my isolation of the Y rotation initially looked like this.

orientation = Quaternion.Euler(0, orientation.y, 0);

Yup. I was grabbing the Y component of the Quaternion, which was expressed in radians, and so my rotation was roughly limited between -pi and pi. With those bits fixed, we’re getting proper rotation, but still getting stuck near the end of the zip line.

The issue is that our code is currently checking if we’re near a particular transform, not for if we’re near the end of the spline… we can fix that ZipLineEnd.position to match the end of our spline.

The speed is also far too fast… I’m not certain if I need to tweak my friction higher, or maybe just decrease the effect of gravity. But, that’s something to work on tomorrow.


메타데이터
post_id
44acc4e5f089
slug
zip-lines-fixing-rotation-and-end-position-44acc4e5f089
url
https://medium.com/@sean.duggan/zip-lines-fixing-rotation-and-end-position-44acc4e5f089
canonical_url
https://medium.com/@sean.duggan/zip-lines-fixing-rotation-and-end-position-44acc4e5f089
author_url
https://medium.com/@sean.duggan
status
ok
fetched_at
2026-06-09 15:37:30