# World‑Space Cylinder Side‑Aligned to Arbitrary Plane Normals

**URL:** <https://discourse.threejs.org/t/world-space-cylinder-side-aligned-to-arbitrary-plane-normals/88770>\
**Category:** Resources\
**Tags:** cylinder, geometry\
**Created:** [December 21, 2025, 7:34pm UTC](https://discourse.threejs.org/t/world-space-cylinder-side-aligned-to-arbitrary-plane-normals/88770 "2025-12-21T19:34:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![red-reddington](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.threejs.org/red-reddington/32/68861_2.png) [@red-reddington](https://discourse.threejs.org/u/red-reddington)\
**Post date:** [December 21, 2025, 7:34pm UTC](https://discourse.threejs.org/t/world-space-cylinder-side-aligned-to-arbitrary-plane-normals/88770/1 "2025-12-21T19:34:36Z")

</div>

I’m working on a snake game and needed a way to generate a cylinder‑like body segment that:

- Rests _along_ an arbitrary surface (not just Y‑up)

- Aligns to a plane normal in **world space**

- Maintains roundness at the contact surface

- Optionally sags along its length

- Can be capped on either end (or both)

I searched around quite a bit and nothing I found was really plug‑and‑play for this use case, especially once arbitrary plane normals and ground contact were involved.

So I built a [helper](https://codepen.io/the-red-reddington/full/vEKBppy) that:

- Constructs the cylinder directly in world space

- Uses a plane normal + point to enforce contact via projection

- Keeps the underside round by lifting the centerline by the local radius

- Supports optional caps per end

- Works at any orientation (camera movement doesn’t affect deformation)

This may turn out to be useful beyond the snake case (pipes, cables, terrain‑hugging meshes), so I figured I’d share it in case it helps someone else.

**[Find it on CodePen →](https://codepen.io/the-red-reddington/full/vEKBppy)**
