I’m trying to recreate a very simple game I made in unity that involved picking up objects and stacking/placing them on top of each other to reach obstacles. I currently have it so that I can pickup objects (this is all in first person), however I feel I’m doing it in an extremely hacky way. I’m using a long thin box component attached to my first person camera and using that as a pseudo raycast.
My question is… Using blueprint, how do I do a simple raycast that shoots from my camera to wherever its looking (and designate length of ray) so that I can get results, designate valid targets, etc?
I was able to do this using camera world location as start point and everything else as said, I’m just curious though, why exactly add 12000 to starting location? I tried playing with this number and it just seems that ray isn’t shooting out straight at lower numbers, which means using this method I can’t have a really short ray distance, is that normal?
12000 is just a long trace out into world (120m). If you use a shorter trace, it should work, but it just might not be far enough to hit thing you want.
I tried this setup and result is same, I have to add/multiply by an extremely high number or else trace doesn’t shoot straight out of camera, but a downward angle.
I’m currently just storing hit object location and comparing it with my player controllers location to do a distance check, so it’s not biggest deal… But I would like to know how to do a small length trace for future uses, but I’m stumped at this point:\
I was able to fix this, problem was just order of operations. Just make sure you multiply forward vector of your start point by whatever length you want it to be, then add that result to world location of your start point. I attached a graph that points this out, thanks for help everyone!