Hey guys, i was hoping you could help me out with converting some python/C# code,
Im trying top achieve rotating the module block,
I understand the principles, but not the syntax or the math. I need to make a Rotate around command, as there is none in Unreal i can see.
My understanding of math is pretty simple, but im willing to give this a go.
C# Code
private void MatchExits(ModuleConnector oldExit, ModuleConnector newExit)
{
var newModule = newExit.transform.parent;
var forwardVectorToMatch = -oldExit.transform.forward;
var correctiveRotation = Azimuth(forwardVectorToMatch) - Azimuth(newExit.transform.forward);
newModule.RotateAround(newExit.transform.position, Vector3.up, correctiveRotation); //Rotate Around? I can not find a similar function in Unreal.
var correctiveTranslation = oldExit.transform.position - newExit.transform.position;
newModule.transform.position += correctiveTranslation;
}
private static float Azimuth(Vector3 vector)
{
return Vector3.Angle(Vector3.forward, vector) * Mathf.Sign(vector.x); //X because x is left right in unity and this code is taken from Unity source code.
}
Id love some help! does anyone know of a command to make a object rotate around a given vector (like a pivot point) similar to this Unity - Scripting API: Transform.RotateAround ?
And how can i handle Azimuth in Unreal engine? Is there an equal command to find a global forward vector?
Anyway, thank you very much! im pretty new to all this.