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

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.

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?

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.

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

Ah… :slight_smile:

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?

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

Nope :slight_smile: 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.

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

Yes, I’ll come back later today hopefully :slight_smile:

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:

Looks like this:

297924-ball.gif

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.

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.

yes you are right

Proof of concept:

Very smooth in real life:

297908-ball.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… )

Thanks, it solves my problem.

Please feel free to mark the answer as correct :wink: