March 2019
Intermediate to advanced
708 pages
17h 9m
English
Getting one object to look at another, with a desired up vector, can be done by calling the correct function, depending on your object's stock orientation. Usually, you want to reorient the X-axis (Forward), while specifying either the Y-axis (Right) or Z-axis (Up) vectors (FRotationMatrix::MakeFromXY()). For example, to make an actor look along a lookAlong vector, with its right side facing right, we'd construct and set FRotationMatrix for it, as follows:
FRotationMatrix rotationMatrix = FRotationMatrix::MakeFromXY( lookAlong, right ); actor->SetActorRotation( rotationMatrix.Rotator() );
Read now
Unlock full access