- Home /
Draw a line to a new pontential character position/target
Need to draw a line like in a strategy game where you select a unit, object and where you want it to move or which target you want it to attack, think hearthstone
$$anonymous$$aybe you can use Raycast and LineRenderer. I'm not sure it is the optimal method, but you can definitly use it.
The origin would be your player.card and the destination the mouse. You should be able to check when the player release is mouse if the raycast destination is in a particular area/or collide with an area.
I've been trying to use line renderer but it acts weird when I try to set point b to the mouses x,y
Answer by davidjohn123 · May 24, 2017 at 01:00 PM
@MJG1123 You can use Raycast to draw in front of camera, using mouse position. Input,mouse position as same as input.gettouch(0).phase For that you should use "Plane" draw use not use box or any other game object |
Same as we use a ball and drage it on to the screen. and it spread a line behind it. As where the mouse is touching the object is following the position. The USe a component "Trail render" and then where your mouse will go the same line will draw as same point on screen. As in strategy games it happens.
https://www.youtube.com/watch?v=cHVZ0SYIHkI
This one can help you for problem Inshallah