Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Custom Force to Match Object
#1
Hi folks,

I'm working on a top-down 2D game where the player navigates around objects that attract/pull the player affecting their path through the level. The player has an Obi Rope (and Solver) attached to him, kind of like a long tail.

The Physics 2D gravity (in project settings) and the Solver.gravity are set to zero. I have set-up an attraction system using Rigidbody2D.AddForce() which attracts the player towards the different "attraction objects", depending on distance.

I set all the rope's CP masses to 0. This is because as the rope moved/waved around, it was affecting the character's center of mass, making the control difficult.

When the character collides with an attraction object, he naturally sticks there due to the force of attraction.  The rope currently just drifts/floats around when the character is stuck to an attraction object, as expected in zero gravity and with zero-mass.

I need the rope to also stick to this attracting object with the same force the character is attracted.


What do you recommend I do to get this working? Could I increase the mass of the particles (or CPs) directly at runtime when the character is in contact with an attraction object? Should I use the Solver.gravity or Solver.externalForces to control this?

Also, what's the difference between using Solver.gravity and Solver.externalForces from the perspective of a particle?
Reply


Messages In This Thread
Custom Force to Match Object - by docgonzzo - 25-10-2022, 12:31 AM
RE: Custom Force to Match Object - by josemendez - 25-10-2022, 07:21 AM
RE: Custom Force to Match Object - by docgonzzo - 26-10-2022, 12:22 AM
RE: Custom Force to Match Object - by josemendez - 26-10-2022, 07:52 AM
RE: Custom Force to Match Object - by docgonzzo - 27-10-2022, 12:06 AM
RE: Custom Force to Match Object - by josemendez - 27-10-2022, 07:39 AM