I am currently making a script that allows you to be able to rotate around a vector, with gravity and previous velocity taken into account to make it feel as smooth as possible, but I have no clue where to start with calculating/applying centripetal force for the actor. I want to do it in an, “Add Force” node. Any help is greatly appreciated, thank you.
Hello! You can use analogy. If you rotate point with some mass, with velocity v around radius of R and having none radial movement, than a = vv / R* and it’s direction - to the center of rotation. In most cases that force is generated by constraint object (chain, rope, etc). Unreal has several classes to work with some physics constraints, take a look at that Constraints User Guide | Unreal Engine Documentation
So I actually don’t want to use a constraint object, I want it to kind of like revolve around the point when a key is pressed? If using a constraint object would help with that then I’m open to it.
Ok! So you could just use more common formula
a = - R (V V) / (R R) - R (V R) / (R R)
Here R = ballPointLocation - centerPointLocation and V is ball Velocity. The first one is centripetal force while the second - nullify radial movement. Braces is just Dot Product
Sorry I’m so late to reply but could you please give me a blueprint example of this I’ve been trying to understand this and its just not clicking. Thanks.
Hello! This is very basic method - just to use AddImpulse and change velocity primarily. I prefer C++, so this BP solution is very raw =) But the main idea is working - just change impulse in a way it will be changed by rope (virtual rope constraint). So, perpendicular velocity is saved, but the other is zeroed. To find them just calc vector betwee center of rotation and actor you want to rotate.