I’m having issues understanding how rotations work in the engine.
I’m doing a simple Portal prototype to understand Blueprints (most of what I’ve learnt so far has been on C++).
My idea is to teleport the player at the other Portal location with a custom rotation, as explained in the image below:
The idea is to take the rotated portal actor’s normal, get the difference with the player forward rotation, create a rotation that is the Opposite Portal’s rotation with the applied difference, and set the Player rotation to that rotation on Teleport.
It is, indeed, the First Person Character.
Now that you mentioned that, I tried casting the “Other Actor” to BP_FirstPersonCharacter, then “Get Controller” and then “Set Controll Rotation”, but it didn’t work, the result is the same as shown in the video
You could use a BP interface on the portal to execute an implemented BPI function on the character. Thus let the character teleport itself. This would make working with CMC a lot easier. Just pass the exit portal normal and location to the BPI function.
Now on the character you have direct access to CMC and should have access to a fully casted controller reference.
Calc pawn rotation and move to location, teleport, rotate.
First, you shouldn’t need to use normals at all to recreate a rotation.
If you want an absolute world rotation, just … use that rotation.
if you want a relative rotation, you multiply first by the inverse of the source rotation (so you get back to world space) and then multiply by the target rotation (to get it back to that space.)
Second, are you rotating the actor, or the camera/control perspective?