Beraliv
Beraliv

Reputation: 564

How to calculate final force vector for the SKSpriteNode

Good afternoon, everybody!

I am creating space game which has an effect similar to black hole's gravitational effect. Wherever the spaceship is going, the black hole will attract it, summing up all the vectors together.

I know SKFieldNode has a method customFieldWithEvaluationBlock: that allows to calculate everything myself, but might it be another way to do that?

I have tried almost every type in SKFieldNode, but nothing helped.

  1. There are some side effects that don't suit me (i.e. If I use an electric or magnetic field, the object repels from the black hole)
  2. Moreover, moving with SKAction (i.e. for the spaceship) doesn't allow me to sum all movement vectors together (I cant do - (void)moveTo:duration: actions simultaneously, even with grouping the actions)

What can you advice me? Thank you in advance!

Upvotes: 0

Views: 90

Answers (0)

Related Questions