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 the length of the ray) so that I can get results, designate valid targets, etc?
I was able to do this using the camera world location as the start point and everything else as rama said, I’m just curious though, why exactly add 12000 to the starting location? I tried playing with this number and it just seems that the 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 the world (120m). If you use a shorter trace, it should work, but it just might not be far enough to hit the thing you want.
I tried this setup and the result is the same, I have to add/multiply by an extremely high number or else the trace doesn’t shoot straight out of the camera, but a downward angle.
I’m currently just storing the hit object location and comparing it with my player controllers location to do a distance check, so it’s not the 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, the problem was just the order of operations. Just make sure you multiply the forward vector of your start point by whatever length you want it to be, then add that result to the world location of your start point. I attached a graph that points this out, thanks for the help everyone!