Yo! I have a project from school where we have to make a game using one input. So I was thinking about replicating inflating from little slime blows up. I analysed the video and some more videos about soft body and I got my player to inflate! But I got some problems:
1: When I inflate, sometimes the player just spins.
2: Inflating while moving the character also spins the player.
3: I'm not sure about whether using rb.AddForce(f, ForceMode2D.Impulse) or rb.AddForce(f, ForceMode2D.Force).
Should I calculate Vector2 dir = (rb.position - center).normalized or do something with the radius?
At the start of the game I spawn circles with rigid body 2d, circle colider 2d and springs. Then I connect the springs.
When the player presses the space bar, bJumpButtonPressed is set to true and then in fixed update I calculate the direction vector:
I get the position of the rigid body of the circle - the centre point of the player (I have uploaded a picture of this vector * 10 in the red line).
and as long as you hold the space bar, you stay in the inflating state.
When you release, the circles should stop inflating and return to where they were before. (which they do)
The problem? Sometimes the player just spins itself, causing the inflating to move the player left or right (which I don't want). And that's without mentioning the fact that I'll need to move the player right which makes the spinning even more problematic
Scripts:
Spawning the circles and connecting the spring joints: https://paste.mod.gg/ohhzsonauhds/0
Inflating the player and moving it: https://paste.mod.gg/gcqnreqyvtie/0
A tool for sharing your source code with the world!
A tool for sharing your source code with the world!