# How to move my rollling ball camera by touching around a cylinder by targeting centerline of cylinder in ue4?

**URL:** <https://forums.unrealengine.com/t/how-to-move-my-rollling-ball-camera-by-touching-around-a-cylinder-by-targeting-centerline-of-cylinder-in-ue4/462495>\
**Category:** Cinematics & Media\
**Tags:** rolling-ball, unreal-engine, Blueprint, question\
**Created:** [March 16, 2020, 8:15am UTC](https://forums.unrealengine.com/t/how-to-move-my-rollling-ball-camera-by-touching-around-a-cylinder-by-targeting-centerline-of-cylinder-in-ue4/462495 "2020-03-16T08:15:06Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![El-Carto](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@El-Carto](https://forums.unrealengine.com/u/El-Carto)\
**Post date:** [March 16, 2020, 8:15am UTC](https://forums.unrealengine.com/t/how-to-move-my-rollling-ball-camera-by-touching-around-a-cylinder-by-targeting-centerline-of-cylinder-in-ue4/462495/1 "2020-03-16T08:15:06Z")

</div>

I’m trying to build a ball-tower game for mobile platforms. My ball will be able to move only a floor or stairs placed the around of a tower. When the ball goes left, right or jumps up, the camera should follow it by turning. I mean the camera should follow the vertical center line of the tower cylinder. How can apply it with a blueprint? Check the attached screenshot to get it clearly.

 ![297903-capture.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/d/c/4dc8a3c9a1ad6d2773d7bdc75f93077b3ea7920c.png)

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [March 16, 2020, 8:18am UTC](https://forums.unrealengine.com/t/how-to-move-my-rollling-ball-camera-by-touching-around-a-cylinder-by-targeting-centerline-of-cylinder-in-ue4/462495/2 "2020-03-16T08:18:50Z")

</div>

I’m assuming you mean the camera should always point at the center of the tower ‘through’ the ball. So it’s always pointing at both?

---

<div class="post-metadata">

**Author:** ![El-Carto](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@El-Carto](https://forums.unrealengine.com/u/El-Carto)\
**Post date:** [March 16, 2020, 8:25am UTC](https://forums.unrealengine.com/t/how-to-move-my-rollling-ball-camera-by-touching-around-a-cylinder-by-targeting-centerline-of-cylinder-in-ue4/462495/3 "2020-03-16T08:25:45Z")

</div>

Yes, I mean that the camera should be on a line that is intersecting both the center of the ball and centerline of the cylinder tower.

---

<div class="post-metadata">

**Author:** ![El-Carto](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@El-Carto](https://forums.unrealengine.com/u/El-Carto)\
**Post date:** [March 16, 2020, 8:28am UTC](https://forums.unrealengine.com/t/how-to-move-my-rollling-ball-camera-by-touching-around-a-cylinder-by-targeting-centerline-of-cylinder-in-ue4/462495/4 "2020-03-16T08:28:53Z")

</div>

A developer suggests moving tower by fixing the ball, but it is not a solution that I’m looking, because I will add many static meshes by simulating physics. It doesn’t meet my reqs. by the way, thank you for your replying

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [March 16, 2020, 8:35am UTC](https://forums.unrealengine.com/t/how-to-move-my-rollling-ball-camera-by-touching-around-a-cylinder-by-targeting-centerline-of-cylinder-in-ue4/462495/5 "2020-03-16T08:35:57Z")

</div>

Ah… 🙂

So you need to do a kind of ‘back to front’ calculation to find where to put the camera.

Usually we trace from the camera, but in your case, trace from the center of the tower with ‘look at rotation’ to the ball. This is the line, then just add your camera distance to the end?

Do you get it?

---

<div class="post-metadata">

**Author:** ![El-Carto](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@El-Carto](https://forums.unrealengine.com/u/El-Carto)\
**Post date:** [March 16, 2020, 8:55am UTC](https://forums.unrealengine.com/t/how-to-move-my-rollling-ball-camera-by-touching-around-a-cylinder-by-targeting-centerline-of-cylinder-in-ue4/462495/6 "2020-03-16T08:55:00Z")

</div>

I think yes, you mean, find firstly ‘look at rotation’ to the ball then assign its the opposite value as camera location. Right?

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [March 16, 2020, 9:00am UTC](https://forums.unrealengine.com/t/how-to-move-my-rollling-ball-camera-by-touching-around-a-cylinder-by-targeting-centerline-of-cylinder-in-ue4/462495/7 "2020-03-16T09:00:59Z")

</div>

Nope 🙂 It’s a little counter-intuitive. I’m just starting to knock an example together, but will need to get back later this morning…

Imagine a point at the center of the cylinder. Look at rotation trace from that point to the ball. This gives the correct line, now extened out a fixed amount, that’s where the camera goes.

The only slightly tricky part is finding the center of the cylinder opposite the ball. But I think if you have segments of the tower as BPs, this will not be a problem and lead to an interesting camera effect.

---

<div class="post-metadata">

**Author:** ![El-Carto](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@El-Carto](https://forums.unrealengine.com/u/El-Carto)\
**Post date:** [March 16, 2020, 9:35am UTC](https://forums.unrealengine.com/t/how-to-move-my-rollling-ball-camera-by-touching-around-a-cylinder-by-targeting-centerline-of-cylinder-in-ue4/462495/8 "2020-03-16T09:35:59Z")

</div>

Thank you, I will try to apply your idea. But I would be glad if you help more in the future.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [March 16, 2020, 9:51am UTC](https://forums.unrealengine.com/t/how-to-move-my-rollling-ball-camera-by-touching-around-a-cylinder-by-targeting-centerline-of-cylinder-in-ue4/462495/9 "2020-03-16T09:51:44Z")

</div>

Yes, I’ll come back later today hopefully 🙂

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [March 16, 2020, 10:55am UTC](https://forums.unrealengine.com/t/how-to-move-my-rollling-ball-camera-by-touching-around-a-cylinder-by-targeting-centerline-of-cylinder-in-ue4/462495/10 "2020-03-16T10:55:05Z")

</div>

Proof of concept:

 ![297907-graph.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/3/5/c352c3eada5000b7bae503f821b473785302da5b.jpeg)

Very smooth in real life:

![297908-ball.gif](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/d/28ded71cd4503f66f34019399810119fad00cd13.gif)

I put a camera in the level and set it to auto activate for player 0. The ball has actor tag ‘ball’. ( Center is a scene component at the center of the cylinder… )

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [March 16, 2020, 11:51am UTC](https://forums.unrealengine.com/t/how-to-move-my-rollling-ball-camera-by-touching-around-a-cylinder-by-targeting-centerline-of-cylinder-in-ue4/462495/11 "2020-03-16T11:51:52Z")

</div>

I had another go. Moved the scene inside the cylinder to the bottom ( so cam is always looking down ) and put a collision volumne around it ( see pic ). Now two cylinders, when the ball enters the volume, the BP takes control of the camera:

 ![297921-twocyl.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/2/e/52e91b72a5935ee555bf502cf5e408e49e72cb08.jpeg)

Looks like this:

![297924-ball.gif](https://d3kjluh73b9h9o.cloudfront.net/original/4X/c/f/e/cfe834ebfa0e88d1a99333c0be1c12fc4f3453c0.gif)

---

<div class="post-metadata">

**Author:** ![El-Carto](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@El-Carto](https://forums.unrealengine.com/u/El-Carto)\
**Post date:** [March 16, 2020, 12:09pm UTC](https://forums.unrealengine.com/t/how-to-move-my-rollling-ball-camera-by-touching-around-a-cylinder-by-targeting-centerline-of-cylinder-in-ue4/462495/12 "2020-03-16T12:09:58Z")

</div>

Actually, it is very near that I need. Only I want to ask something. If I put the cylinder in the center of the coordinate system then I try to move the camera on Z-axis only, isn’t that a better solution, because I only have one tower on each level.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [March 16, 2020, 12:13pm UTC](https://forums.unrealengine.com/t/how-to-move-my-rollling-ball-camera-by-touching-around-a-cylinder-by-targeting-centerline-of-cylinder-in-ue4/462495/13 "2020-03-16T12:13:45Z")

</div>

Even if you put the cylinder at 0,0 you have to move the camera in all 3 planes, otherwise you can’t follow the ball around the track.

---

<div class="post-metadata">

**Author:** ![El-Carto](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@El-Carto](https://forums.unrealengine.com/u/El-Carto)\
**Post date:** [March 16, 2020, 12:26pm UTC](https://forums.unrealengine.com/t/how-to-move-my-rollling-ball-camera-by-touching-around-a-cylinder-by-targeting-centerline-of-cylinder-in-ue4/462495/14 "2020-03-16T12:26:07Z")

</div>

yes you are right

---

<div class="post-metadata">

**Author:** ![El-Carto](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@El-Carto](https://forums.unrealengine.com/u/El-Carto)\
**Post date:** [March 20, 2020, 5:58pm UTC](https://forums.unrealengine.com/t/how-to-move-my-rollling-ball-camera-by-touching-around-a-cylinder-by-targeting-centerline-of-cylinder-in-ue4/462495/15 "2020-03-20T17:58:34Z")

</div>

Thanks, it solves my problem.

---

<div class="post-metadata">

**Author:** ![ClockworkOcean](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/clockworkocean/32/1169999_2.png) [@ClockworkOcean](https://forums.unrealengine.com/u/ClockworkOcean)\
**Post date:** [March 20, 2020, 6:41pm UTC](https://forums.unrealengine.com/t/how-to-move-my-rollling-ball-camera-by-touching-around-a-cylinder-by-targeting-centerline-of-cylinder-in-ue4/462495/16 "2020-03-20T18:41:44Z")

</div>

Please feel free to mark the answer as correct 😉
