Activate Draw Debug Type “For Duration” to constantly show the lines of the trace
Observe: The moment you use the built-in Teleport from the VRPawn the Line Trace is totally off and is pointing in weird directions without any pattern to it. I really have no idea why.
Seems like them somehow the transformation of the Teleport offsets the pistol somehow, but the gun and all its children (eg. the Muzzle Location) are parented to the grabbing hand, so this should not happen.
Can anybody help me with this? It is really important and I am completely lost
You can see this behaviour in images below, where for debug purposes I attachted a laser pointer to the muzzle location to show the forward vector, and in comparison the current line traces which are totally off from this true forward direction:
I was standing still for the above pictures so the line trace debug lines are actually off from the right direction. I do not see any actual pattern on the line trace, sometimes it is off a lot, sometimes nearly right
Is there any possible way you could get the behavior on video? The pictures are great and all but it’s really hard to tell what direction you’re turning, etc.
Yes sure Mind-Brain no problem! Here you go.
Do not worry about the block, that is just for a project of mine and is spawned at the end of the line trace. But because the line trace is off, so is the block at the end ^^
The behaviour is sooo weird and I have no idea why this is happening. I changed nothing about the VRTemplate excpet for the map a little bit as you can see.
So I printed the forward vector and that one is always right, even when the line trace itself is not, so this is not the problem.
But when I increased the hit distance to 100 000 it finally worked. I don’t understand why? Does anybody have an idea?
I actually need a smaller hit distance in the end, because I want to be able to select an arbitrary point in the air too (without a hit).
I was finally able to fix my problem and it was fairly trivial after I understood what I did wrong.
For anyone who has a similar problem sometimes in the future:
After multiplying my direction (forward vector) by a float I forgot to add the starting location (GetWorldLocation) to it.
So GetForwardVector * Float only ever gives me a direction and the reason why this worked when multiplying it with a very big number (100,000) was because after the direction got big enough it converged with the intended direction.
As you can see in my fixed solution, I can now use a much smaller Float (1000) to perform the linetrace because the “direction” (GetForwardVector) now has the starting location added to it.