a548922
(a548922)
October 10, 2017, 5:33pm
1
I am needing to create a Raycast from a fixed camera location that can generate from the mouse location on the view port. Think of it like an Arcade game where you have to create a bullet that spawns from the camera to the location where the mouse is clicked.
This was my unsuccessful attempt:
Any Suggestions or Help?
redbox
(redbox)
October 10, 2017, 6:39pm
2
Better use PlayerController - ConvertScreenToWorld. This will be MouseWorldLocation and line trace start.
Then use line trace end = MouseWorldLocation + CameraForwardVector*TraceDistance
a548922
(a548922)
October 10, 2017, 8:27pm
3
Will this still use the Camera as the line trace start?
redbox
(redbox)
October 11, 2017, 6:34am
4
No, GetPlayerController → ConvertScreenToWorld already uses screen coordinates converted to world.
a548922
(a548922)
October 11, 2017, 2:41pm
5
Its only going to one location on the screen… What am I doing wrong?
a548922
(a548922)
October 11, 2017, 3:32pm
6
I’m sorry I am having trouble with this. Are you able to show me screen shot please?
redbox
(redbox)
October 11, 2017, 3:28pm
7
Not screen location here. mouse location to world space for start
redbox
(redbox)
October 11, 2017, 6:08pm
8
you already have ‘convert mouse location to world’ function in graph. just plug it into trace start.
a548922
(a548922)
October 12, 2017, 3:52am
9
This is what happens when I click anywhere on the screen:
Using:
redbox
(redbox)
October 12, 2017, 6:44am
10
Can’t ou see that you convert (0,0) screen location from that node?
Use mouse location also!