A matemathician will probably think this was a silly question, but I’m not one and I’m in need of help 😀
I’m working in Godot and with it’s
RigidBody2Ds (objects that have automated physics behaviour).
I want to create a spring of type
RigidBody2D (the ‘springyness’ is not the only function of this object).
I’m at the point in code where this spring and another
RigidBody2D collide so I have all information about the two bodies at the moment of collision.
My goal is to make any body that touches the spring reach a certain height (from the spring), and move by certain speed horizontally, as you can see in the picture
So, the information about both bodies I have is: position, velocity, gravity scale, mass, weight.
What I want to achieve is constant line of movement of any object (that may have different properties I mentioned above) by applying a certain force to the colliding object.
EDIT: forgot to mention that I can stop the body before applying new force to it, that is, at the time of collision.
Rotation, friction, absorbtion and similar properties don’t need to be counted on as the game I’m making is a simple one. With this I’m trying to make a predictable movement for the player to count on. I also plan to disable collision briefly at the time of collision so that the colliding object can touch the spring from any angle and the collision result would be the same.