Hello there!
First off I’d like to say this is my first time developing a game in 2D in unity, as I recently upgraded from Unity 3.5.5 (It was for a college project) and decided to upgrade to Unity 5 and I was wondering: Is it possible to use raycasting to create a ‘boomerang’ attack? Would this be more suited for something made in a 3D environment or should I stick with 2D?
I also haven’t started working on the code as this is my first time working with a raycast, too.
(‘Boomerang’ as in something that travels along the raycast and comes back to the player before ending, think of something like Ahris ‘Orb of Deception’ ability from League of Legends)
You’d probably want to disable gravity on the boomerang itself.
So just create a force vector relative to your aiming direction (towards the mouse? straight ahead of the player? I’m not sure of what 2D perspective you’re using) and use AddForce() to apply it. Returning the boomerang is the same thing just with a vector back to the player.
I’m planning on having the boomerang instantiate in-front of the player (by which I mean like, to the right/left of the screen, depending on which way they’re facing).
Thanks allot though! I hadn’t thought about using AddForce.