Rotators moving in an arc

I made a security camera that moves back and forth between two points, and tracks the player if it sees them.

For some reason, the camera moves in a wide arc when moving from point A to point B. When moving from point B to point A, it moves in a straight line. When the camera tracks the player it does it accurately without any arcing.

I’d like for the camera to just move in straight lines all of the time, but I’m not sure what’s causing the arcing.

1 Like

So you’re doing the lookatrotation from the root, but moving the sphere ( whatever that is ). Can you show the setup?

Sphere is the mesh, currently a placeholder. I move the sphere and not the root because the scanning points A and B are local space vectors that would move if the root rotation were changed.

1 Like

Can you show a gif or vid of it doing this weird thing?

At the moment, I can’t see anything wrong with the code.

( Although maybe that radial force component is not helping? )

I don’t think the radial force is affecting this, it’s from the parent and is set to be not active until a certain event fires.

Now that I’m thinking about it, the arc movement I’m seeing is probably just the shortest possible path. When the two points are on the same x or y plane, we don’t really see the issue, but when they’re different, it almost looks like the rotator rotates on one axis first and then the other, which might be making it look like it’s moving in an arc in one direction then in a straight line in the other.

1 Like

Can you do another vid showing player tracking, then have it pop back to regular sweeps?

I think you might be right, it’s just the rotation taking a slightly strange path.

Maybe keeping the local tracking points in one plane will help.

I’m wondering if there’s a way to break the rotator into just the pitch and yaw, then both with two sequential setWorldRotation nodes?

1 Like

Quite possibly, but if you get weird problems, that would be because of the splitting.

Yeah I’m probably just going to do this. Not worth the hassle lol

1 Like

I know it’s often tempting to ‘take the challenge’, but often it actually doesn’t matter, it’s just a kind of pride issue.

I had it the other day with something, can’t recall what, but in the end I let it slip because no one would ever notice the difference :rofl:

1 Like

So true :smiling_face_with_tear:

1 Like