# Manually calculate and apply rotation velocity

Good morning/evening everyone!
It would seem I need some assistance with a bit of vector math. The short version is:

• I have an object attached to moving hand that, when dropped, loses all linear and rotational velocity.
• On Detach, I re-apply the linear velocity it had prior by manually calculating it OnTick and using Add Impulse.
• I need to the same with it’s rotational velocity (presumably using Add Torque or Add Radial Impulse), but I’m having trouble manually finding the rotation vector and re-applying it.
• I can’t use Get Physics Radial Velocity as they respectively return Zero Vectors, likely because the setup uses massive damping to remove drift.
• Because of the above, I need to know how to Manually calculate an object’s rotational velocity and properly apply the resulting value(s) to the physics body.

The long version:
I’m working on a custom VR setup that has physics properties, and have set it up so that the player’s hands and held objects don’t pass through meshes. None of it uses Physics handles because they have an inherent lag to them and don’t track with the player’s movements as well as expected, so I’ve managed to get the physics collision working through a couple stages of AttachToComponent while maintaining accurate real-time tracking.

The downside is that since the system uses a couple levels of AttachToComponent and massive increases to Linear/Angular Damping to remove drift, when I drop an object using Detach it has no inherent velocity, so I have to manually calculate it based on position change and re-apply the velocity it had prior to the detach.

Now, I have the linear velocity part working perfectly. On tick it checks the objects current location against it’s position in the last tick, does some subtraction, and we have a velocity vector that I can easily re-apply after detach using Add Impulse.

Logic would dictate that I should be able to do the same/similar process by comparing the object’s current rotation against it’s previous rotation, get the difference, and re-apply using either Add Torque or Add Radial Impulse, but unfortunately this doesn’t seem to be the case. There’s obviously something I’m missing in the process, as I thought Add Torque would be the best application of the resulting vector since I just want it to ‘resume’ it’s previous rotation direction and rate (but Add Torque is advised again in the node’s info).

Meanwhile, Add Radial Impulse calls for Origin, Radius, and Strength, and a little reading indicated that Radial Velocity is the measure of one object’s rotational movement around a point, which can work but seems more complicated a solution than is necessary when I simply want the object to rotate locally.

My current attempts have been to get the object’s current rotation/rotator, break it into axes, subtract it’s previous rotation broken the same way, and try to re-assemble those axes into a vector to then be applied through Add Torque. When that didn’t work, I tried Add Radial Impulse, but there are additional values it needs that aren’t well explained by the documentation, and on that failure I got a readout of the values to discover that the resulting vector is erratic and very small, so I believe I’m missing something.

I’ve got this -somewhat- working, but I think I’m still doing something wrong in the process of turning the difference between rotators into a usable vector. Here’s an image showing two different methods that add rotation (when the resulting vector is applied using AddTorque), but the amount doesn’t seem accurate. It’s usually over-exaggerated, which leads me to believe I’m still a little off somewhere.

In doing some tests myself with trying to calculate both liniear velocity and accelerations manually i ran into similar spikes in values if thats what you experience too? You did say that u had the liniear part sorted out perfectly, i would love to hear or see how you did that. For the rotation i didnt get that far sadly so cant really provide much info there yet.

Out of curiosity. How did you manage to set up collision while using attachtocomponent, while still respecting collisions with world?