Add Force if GameObject is detected in a Polygon Collider 2D

Updated on August 16, 2017 in General
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
7 on August 11, 2017

Let’s say that I have a Player, and my player can walk, run, and jump. Also, my player has a Polygon Collider 2D and if 2D GameObjects( with a Rigidbody2D and Box Collider 2D) are detected in the Polygon Collider 2D the Player will Add Force to movable 2D GameObjects that are in the Polygon Collider 2D to be pulled towards the Player.

  • (One)- How can I detect if any 2D GameObjects are in the Polygon Collider? & (Two)- How can I Add Force to movable 2D GameObjects that are in the Polygon Collider 2D to be pulled towards the Player?

—— Please code and explain your answer, for I am new to unity and won’t understand if you just give me directions, I don’t just use your code and forget about it, I write it down in my note book line to line and review and study it on my free time

  • Liked by
Reply
2 on August 11, 2017

We are not here to do your job. You need to do stuff yourself. Use Google aswell.

Google: unity detect object in collider

And for the force part you just add force…

on August 12, 2017

Sorry.

on August 13, 2017

@Leon Laci 

Every time I ask you questions about my scripting problems no one replies

 

Pulling Objects to Player using force

Show more replies
  • Liked by
Reply
Cancel
0 on August 11, 2017
  • Liked by
Reply
Cancel
2 on August 13, 2017

not sure sorry 

Guru
on August 14, 2017

If you don’t have an answer there is no need to reply

Devoted
on August 16, 2017

I think it still shows support, and acknowledgement…

Show more replies
  • Liked by
Reply
Cancel