Rotate physics object towards camera direction over time

It still sorta works with the regular AddTorque node but its incredibly slow and the oscillation is extremely high, I guess I’d have to bump up the multipliers and derivative coefficient to get it to work normally?

Actually I don’t have to change the in the derivative coefficient value, multiplying the original multiplier values by 100 seems to do the trick and it works the same as before now.

Yeah everything is the same as before with the regular AddTorque node, I’m fine with making a tonne of changes if it means the end product is better.

Can you show me where to get the quaternion plugin.

Hmm idk the only one I can see costs $5.48 for me.

Alright I bought it, I’ll try to do what you posted earlier.

Can you show me what you’re doing for AddTorque with your roll?

sorry, my bad… I thought it is free… it is really useful though if you are doing more advanced rotation of your pawn and camera (basically… what you are doing right now). This is all fairly challenging… you are jumping in towards the deeper end.

excellent question… it’s a similar expression to before (converting from local to world rotation… but in 4d quat format not 3d rotator format) but afaik without the possibility of gimbal lock…

I’m still very lost about what to do get this working for the yaw and pitch. Sorry for needing to be spoonfed through out all of this lol but I really don’t understand quaterions.
We should probably stop replying here before we cant fit letters in.

What is this madneess.##

1 Like

Lol no ideaaaaa, probably cause we keep replying so the thing keeps getting smaller, literally had to copy and paste some messages into note pad to actually read them.

Ok I got it, decided to make a separate answer so it’s not squished in that massive thread but thanks aNorthStar.
Anyway here’s the blueprint:

This works perfectly for what I need, no gimbal lock stuff.

1 Like

@everynone… LOL… you are right… madness! and UE4 physics is a flipping DEEP subject…

@seedonator… your BP is looking quite tight: you really took on a challenge… well done! A handful of suggestions though…

  • Drive a specialized MMTAddTorque and PID calcs from the special MMTTick (with the appropriate substepping settings) so it will perform similarly across different spec machines, or scale the normal AddTorque by WorldDeltaSeconds (I’ve heard this also works… maybe @everynone would comment yay or nay?)
  • Using the SkeletalMesh WorldTransform and is logically correct, it would just be better to use FromComponent to get a quat from the Skeletal Mesh and plug it directly into GetUnrotatedRotation (more efficient and better to use pure quats than ANY transforms with 3DOF movement… gimbal lock risk… afaik)
  • Your approach using Quats converted to Rotator as the error is valid… there might be a gimbal lock and flipping issue inside the PID… My current approach is to use Quats converted to Vectors as the error. But if your way works well enough, it’s great :slight_smile:
  • For efficiency, maybe store WorldDeltaSeconds (or PhysicsDeltaSeconds if you use MMTTick) as a variable, it saves you accessing it every time you use it

What are these 2 functions “Add Measured Error” and “Get Control Coefficient”?
Can you make an example project, please?