- Home /
Help with a target reticle moving across terrain
I am making a game for my scripting class and cannot figure out how to do this or even go about it. I am making a top down plane shooter and I was hoping to get a target reticle to be a child of the plane(player) so the player could drop bombs and the they could see visually where they would drop. My problem is I want the target reticle to move across the terrain instead of going through it because I do have uneven terrain. The bomb will fall in a trajectory of which I haven't decided yet but it will fly out and down instead of just straight down. I am only familiar with Js by the way. Thanks for looking.
There are a couple solutions and each have different uses; it's hard to say which is the best from your description.
Raycast and place the reticle on the terrain surface.
Draw the reticle as an overlay; in this case it will not move about but still draw on top of everything else.
Ensure that the cursor is at a height that will be above the terrain at all times; this will probably only work for orthographic projection.
If you're bomb fires forward and down at a constant velocity, and your terrain is uneven, then number one is probably your best bet. You can use a projector to draw the cursor directly onto the terrain and it will conform to it's shape without having to constantly rotate it to match the terrain's normals. It will also have the benefit of moving closer to the fighter when the terrain is higher, thereby giving the player a better approximation of where the bomb will actually land.
Thanks the the reply iwaldrop, but think i am going to go with jbarba_ballytech's suggestion. It seems to work in the simplest way that still works. But again thank you for reply.
Yeah, although I buried it in my comment, I think the projector route is the best.
Answer by hoy_smallfry · Feb 04, 2013 at 11:25 PM
If you create an alpha mask of the reticle shape, you can change the shape of a spot light:

How to do this: Create a spot light, attach to your bomber. Then, set the "Cookie" property to the texture. To avoid texture tiling, set the texture Wrap Mode to Clamp instead of Repeat. Change the intensity and colors to your liking.
Now, the reticle will never clip out of the screen because it's part of lighting!
jbarba_ballytech, Thanks for the answer I believe this will work. :D and thank you for the mock up.
Your answer
Follow this Question
Related Questions
Make a simple tree 1 Answer
object following a target : pb if rigidbody activated 0 Answers
Rotating an object toward target AND with terrain? 1 Answer
procedural path painting on terrain 1 Answer
Terrain brushes cannot be set - BUG 1 Answer