At 05:35 we test drawing the debug camera using DrawDebugCamera using the location \rotation of the Gun via GetActorLocation\GetActorRotation.
The Drawn Camera is placed at the right location in the viewport but noticed that the camera image is not pointing in the same direction that the player gun was pointing, seems to be drawn at approx 90°. from the direction the gun is facing.
I noticed this in the tutorial as well.
Is it something to with the gun being attached to a socket ?
After pushing Fire (Left Mouse) the camera was drawn as shown.
For the screen shot I moved back after pressing fire , the player was moved a few steps backwards (not rotated) as the player was obscuring the view.
I started to do some digging and found that imported models are using the +Y axis (mostly) to represent forward direction and unreals own components are using forward direction with +X.
My finding are as follows
Imported Asset Rifle: Points forward on the +Y axis for both Global \ Local Axis
Unreals components: Camera & Spring Arm both points Forward on their +X Global\Local Axis
Imported Asset Skeletal Mesh: Wraith_OD_Green: Points forward on its Global +X axis but also points forward on its local +Y Axis ?
So in conclusion, the built in Unreal components such as Camera+Spring Arm use +X as there Forward Axis and imported models seems to be using mostly forward as +Y
As the DrawDebugCamera is a built in function, I assume it also using the X axis as its forward direction
which why it facing at 90 ° from the forward position of the gun?
Does this seem right?
One last query, Why are assets importing with different axis for forward vectors to that of Unreal?
The gun is pointing in +Y but it’s still facing +X, what you think is the front of the mesh isn’t the front.
That red arrow in your first screenshot is showing its forward vector.
I can see what direction x is facing, but all that means to me is that when the Rilfle asset was exported from what ever created it, it was not set to have its x axis pointing to the correct forward direction of the model, it is the artist that should decide that right.
As feedback to this beginner course these sort of things need to be explained far better than what has been covered, I still dont understand how the Rifle is even pointing in the right direction, as from what we’ve been discussing the Gun should be moving forward on its side.
I guess this discussion , is moving a little away from the course material so thanks anyway for your responses, I have some other courses to do after I complete this one so perhaps it will be discussed there.
I’ve just watched a introductory video from epic on skeletal meshes, it lasts approx 18 mins and contains some really useful information.
The answer to my question of:
Why is the debug camera drawn 90° from the position the gun barrel is pointing?
Answer: Because unreal uses the +X axis as its forward so the debug camera is pointing forward on the X axis.
I also asked.
You said:
This answer could of been clearer , because though the gun is using the correct rotation, it is the socket that is controlling the guns relative rotation and location so it does have something to do with the direction its pointing.
Yes, sorry. What I was trying to say was that it’s not the attaching itself that is why it’s that direction i.e. it would still be that direction of you didn’t attach it.