• News
• About

• Industries

• Learning & Support

• Community

• Marketplace

Download

# Trying to use Find Look at Rotation for pawn orbiting object

Hello I’m trying to get the player pawn to orbit around a sphere in 3d space while still maintaining pitch control.
(basically, flying around a sphere and able to alter the path on that orbit with pitch alone)

I’m using the Find Look at Rotation from pawn to sphere, and applying that rotation oriented from the side of the pawn.

Everything seems to be working pretty well, but my issue is when I pitch positive or negative too much the whole thing freaks out and re-orients at different pitch orientation.
(ordinary flying outside of this orbit works perfectly btw, with ability to do loops)

Any help is appreciated!

It’s difficult to say without knowing exactly what kind of control scheme you are trying to achieve, I think applying the look at to only the y rotation is the wrong way to do it unless your ship is confined to moving in a 2d plane. What I think might work is to get the full look at rotation in all axes (so the ship is always pulled to the center of the planet regardless of orientation) and apply pitch and yaw as a local rotation and then convert the pitch and yaw from local to world space and apply them as a multiplier on top of the full look at rotation.

Of course this could be wrong, I’m not the greatest at vector math.

A more realistic approach would be to apply look at rotation in world space, apply controls in local space and then get the thruster direction from local and apply to world, because in real life momentum is conserved and the rotation of an object in space is irrelevant to it’s overall path save for the forces acting on it like the thruster.

I’m not sure if you can follow what I’m doing in the blueprint I attached (This is full 3d flight and I’m getting the look at rotation in all axes, and applying them relative to the right side of the ship), but basically what I have works really well, but for some reason whenever I pitch too vertical either positive or negative the whole thing freaks out and re-orients. If I keep the user applied pitch angle far away from straight up/down it orbits perfectly.

When I watch the debug outputs nothing seems off that would cause that behavior to occur. I really needs someone who understands vector math better than I do.

Also my motion is based on the flight example blueprint, so I’m applying an add actor local offset off the tick*forward speed to move the ship forwards.