Click To Move
Last updated
Last updated
The Click To Move component is for games with a top down view and mouse controls, allowing you to click a location on the map to set a target position, and then the rotorcraft will make its way to that target position.
This component does not do any path finding, if an obstacle is in the way the rotorcraft will hit it.
The Click To Move component can be used along side a normal input control component (WASD for example), however, using WASD whilst the rotorcraft is heading towards a target will result in unwanted movement - as the rotorcraft will continue to move to the target position until it reaches it, using other input does not cancel this movement.
Target Visual - Assign a Transform for the visual you wish to place on the ground where the player clicked. This can be left empty.
Camera - This class uses ScreenPointToRay() and requires a camera to do so, if this field is left empty the class will cache and use Camera.main. There is a public property available for you to set this field at runtime.
Min Distance To Move - How far away a new target position needs to be from the rotorcraft, before it will move.
Min Angle To Turn - What is the minimum angle required between the front of the rotorcraft and the target position, before the rotorcraft will turn. Setting this too low will result in wobbly/ shakey movement as the rotorcraft heads towards the target position.