Hey,
currently I´m learning in UE4 while trying to script a little 3rd Person Shooter in Blueprints. So now I´m stucking at the aiming. Of cause I tried some other systems, like moving the projectile start point, but I don´t like this very much.
Well, I want that my weapons spots exactly one point in the world (I did this with an LineTrace starting at the "Get Camera World Location" output; see the pictures). If this LineTrace hits something, I want to set the Pitch- and Yaw-Offset from the AimOffset so, that the weapon spots to the Hit point from the LineTrace.
In pictures:

The Weapon LineTrace. The In-Exec comes directly from the "Event Tick" from the weapon Actor.

This is the Camera LineTrace Blueprint. The In-Exec comes from the Weapon LineTrace

The AimOffset I use (Tutorial from Unreal Docs)

You can see 3 different colors and shapes:
The red circle shows the hit result from the Weapon LineTrace, the red line is that you can see the LineTrace better.
The green ...well, it´s not a circle... shape shows the way that the weapon LineTrace moves (of cause, it´s not exactly!)
The yellow circle shows my Crosshair and the LineTrace from the Camera. Both are exactly in the middle of the screen
Ok, I want that the Weapon LineTrace(WLT) (the projectile follows this LineTrace) is exactly at the point where the Camera LineTrace(CLT) is. (Yeah, I can do it with setting the end-location of the WLT as the same as the Impact Point from the CLT, but I want to move the Weapon to get a realistic weapon aiming).
I thought that I have to get the rotation between these two LineTraces and set the Y and Z value of this rotator to the Pitch and Yaw from the AimOffset, but I don´t know how to do this.
currently I´m learning in UE4 while trying to script a little 3rd Person Shooter in Blueprints. So now I´m stucking at the aiming. Of cause I tried some other systems, like moving the projectile start point, but I don´t like this very much.
Well, I want that my weapons spots exactly one point in the world (I did this with an LineTrace starting at the "Get Camera World Location" output; see the pictures). If this LineTrace hits something, I want to set the Pitch- and Yaw-Offset from the AimOffset so, that the weapon spots to the Hit point from the LineTrace.
In pictures:
The Weapon LineTrace. The In-Exec comes directly from the "Event Tick" from the weapon Actor.
This is the Camera LineTrace Blueprint. The In-Exec comes from the Weapon LineTrace
The AimOffset I use (Tutorial from Unreal Docs)
You can see 3 different colors and shapes:
The red circle shows the hit result from the Weapon LineTrace, the red line is that you can see the LineTrace better.
The green ...well, it´s not a circle... shape shows the way that the weapon LineTrace moves (of cause, it´s not exactly!)
The yellow circle shows my Crosshair and the LineTrace from the Camera. Both are exactly in the middle of the screen
Ok, I want that the Weapon LineTrace(WLT) (the projectile follows this LineTrace) is exactly at the point where the Camera LineTrace(CLT) is. (Yeah, I can do it with setting the end-location of the WLT as the same as the Impact Point from the CLT, but I want to move the Weapon to get a realistic weapon aiming).
I thought that I have to get the rotation between these two LineTraces and set the Y and Z value of this rotator to the Pitch and Yaw from the AimOffset, but I don´t know how to do this.
Comment