How do I…
Hey guys! I’ve decided to implement a new idea into my game to make it more fun and interesting. The idea is, that within a certain distance to a ‘magnet’, a player can press a button and ‘shoot’ towards it, like a bullet going down the barrel of a gun. After colliding with the magnet, the player would arc away, and maybe press a button to collide with another magnet.
Like this:
What is the actual result
I’ve been trying to use forces, but it doesn’t seem to be working at all. I’m trying to do something similar to Ori and the Blind Forest, example here:
Related screenshots
It probably isn’t surprising that this code isn’t working. It seems the only way I can get the acceleration I want, is by making a permanent force. But when all forces are removed, obviously any speed built up by the permanent force disappears. Also by using this code, if I’m not angled in a specific way, I could shoot right past the magnet and not hit it at all, making precision movements impossible. I want to use these eventually for tougher puzzles in the game that will require these sort of tight precisions.
Any suggestions on how to best go about this sort of thing? Or perhaps an alternative idea that can do a similar output? Thank you so much!