How do I make an actor have magnetism?

How I could make an actor have magnetism? My game is just where zombies follow a track and you have to shoot them with a cannon. I want to make an in-app purchase that will make it so that when I shoot the bomb it slightly drifts towards the zombie.

Thanks

Answers

  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    The actors that need to drift towards it need to have an acceleration towards the "magnet".
    Its a little tough if you have more than one magnet since the bomb would need access to all of the zombie's coordinates.
  • VoidedSkyVoidedSky Member Posts: 1,095
    Here is a quick little demo I threw together. All of the constrains might not be good for the processing, but this is just a quick demo to show a method of doing this. It also has some maths using vectortoangle, and magnitude. Hopefully this can help out a bit!

    ~Josh

    :)
Sign In or Register to comment.