Pendulum [harmonic] Physics and steering aproximation.

I am developing arcade game based solely on physics motion. Physics simulation is a lot of fun, and there are many great side effects of using physics only.
However I hit brick wall with 3 problems, that are kind of same (or very similar) from physics point of view.

I describe it all on simplest problem example that is rotating to desired direction. I cannot use damping because at any point during rotating event pawn can have collision. Damping at this time ruins all physics effects. Also interpto and direct feeding rotation totally ruin physics calculations, any time you directly set rotation or location (or add impulse with velocity change) it breaks physics for that frame.

So only way left to me is steering by applied force. Now i am looking for formula that allows me calculate force i need apply to stop physics body right at desired direction.

Simple applying force proportional to rotation difference makes what is my problem. I get different kinds of pendulum movement. I think this (steering) is quite common problem in real world and it was probably solved around 1800 by Laplace, but i just cannot find right formulas on internet. There is also another problem, i have no idea how to get all physical values needed from inside unreal engine. Calculating them from mass and velocity every tick would probably be bit heavy (integrals etc.).

Other two problems that are about same:
Calculating velocity vector for body to stay exactly on circular orbit. And steering current velocity so in way it maches desired. Again trough forces only.
And stopping exactly at desired location. Again only force.

Have you looked into “Steering behaviors for autonomous characters”?
This is a starting point for steering agents over which you don’t have a direct approach. Like for example AI for a spaceship which is physics driven. Controls for a horse character which is driven by locomotion and etc. But it’s not limited to AI, it’s more of a general principal which can be used in all kinds of controllers.
You last use case is what is called Arrival: Arrival steering behavior

Great links. But they all are about boids and flocks, would love to have them 3 months ago (done all my flock logic from different various sources). I am happy with current implementation, and My problem with physics steering is exactly for that: flock of ufos that are physics driven and in frictionless space (so no damping), they just misbehave.

Now i need some more accurate steering for those mad ufo flocks, they all love to get into pendulum state with rotations or instead of stopping they circle around destination.

Btw, where is that link to AI spaceship with physics? That would be exactly what I need. Searching for Space or UFo does not give highlight.

Flocking is indeed a part of it but not a central subject. Check the paper itself: Steering Behaviors For Autonomous Characters

Take a look at this as well:

Oh that GameDEv topic is exactly on topic, will read it all when i have time. Thanks.

If I understand right, you try to get a hovering UFO or some object hovering, and then apply something like a thruster to go wherever you want.

It might be worth checking out something like this:

  1. take a cube, physics enabled, put it above the ground
  2. apply an impulse to it to lift it in the air
  3. make that impulse proportional to the difference in height, which you get by GetWorldLocation, between two subsequent frames.
    Like: Impulse = Impulse - delta(Height)*(some constant) and start impulse is zero.

So when you start the simulation in the air, the cube will fall. But as soon as it falls, there is an impulse building up, trying to lift it up again. The smaller the height difference gets, means the more the cube starts to hoover, the smaller to impulses added by the equation. Eventually you will end up with the exact impulse that is required for hovering, when the difference in height approaches zero.
Then you can add other impulses with the gamepad or whatever.

Like the magic carpet.

I done that, impulse (or force) proportional to rotation or location always leads to pendulum (woobling) movment. Goal is to stop exactly at desired location or rotation.

Substepping ON and iteration solver and position solver of the hovering object really high… does that help? Especially the position solver. (under physics tab of the object)

This is problem of finding “optimal control”, rather than how accurate physics simulation is. I need to find force that i need apply to object over time so it stops perfectly at spot where i want it. Increasing physics accuracy will only make more accurate wobbling.

From looking at math in those threads on GameDev this is quite hard (if not impossible) to do in blueprints and keep good performance of game. For rotation or stopping at destination it looks doable, but making solver for orbital movement is something very not trivial.

PS. i just had idea to simplify orbital. I simulate gravity by applying force that points always to center of planet. But because it is simulation i have perfect antigravity engine. ie. i can change “gravity force” to match exactly “centrifugal” force. Do not need to solve its speed, unless i want that body to be free on elliptic orbit or hit planet.

PPS. I just successfully done orbital movement approximation. PolyPlants suggestion of compensating works with small modification.
Instead of calculating strength of force from distance i needed to calculate real centrifugal force. ie F=m*(V*V/r). then compensate a bit (few percent) for innacuracy of simulation and starting conditions.
Everything works quite well, and calculations are simple.