Dear Jamish,
Do you always know what axis you want to rotate around?
If you always want to rotate around z axis for example you can use this
/**
* Rotates around Axis (assumes Axis.Size() == 1).
*
* @param Angle Angle to rotate (in degrees).
* @param Axis Axis to rotate around.
*
* @return Rotated Vector.
*/
FVector RotateAngleAxis( const float AngleDeg, const FVector& Axis ) const;
example
FVector MyVector = something
//rotate 30 degrees around z axis
FVector ZAxisRotatedVector = MyVector.RotateAngleAxis(30,FVector(0,0,1));
If you dont know that much information, and just have a Rotator,
you can turn that rotator into a Rotation Matrix and the rotate the vector.
**Rotation Matrix**
If you are trying to rotate a Direction Vector (ie, normalized difference between two locations)
```
/**
* Transform a direction vector - will not take into account translation part of the FMatrix.
* If you want to transform a surface normal (or plane) and correctly account for non-uniform scaling you should use TransformByUsingAdjointT.
*/
FORCEINLINE FVector4 TransformVector(const FVector& V) const;
```
```
FRotator MyRotator = //the rotator to rotate the Vector by
//Rotation Matrix
**FRotationMatrix MyRotationMatrix(MyRotator);**
FVector RotatedDirVector = MyRotationMatrix.**TransformVector**(YourVector);
```
Normalized Impulse
If the RotationMatrix doesnt seem to work then give it the normalized version of your impulse, and get the length of the impulse so you can reapply its length/magnitude after getting the rotated impulse direction.
FVector RotatedImpulse = MyRotationMatrix.TransformVector((Impulse.SafeNormal());
RotatedImpulse *= Impulse.Size();