Hi all.
Tell me how to move an object to a certain position using Physics2? (to another object)
What does the object represent?
The only ways I can think of is to use a joint on the object and the position you want to move it to. Or by placing another static object with a restitution of 0 that the moving object will collide with.
But you can’t by applying a force to an object and relying on the object to stop moving due to friction. Unless you can calculate the exact force to apply, it’ll won’t be very accurate.
And if you move it using non-physics actions, then you run the chance of screwing up the physics of the object and causing it to behave in bizarre ways.
Make Sprite 001 (red box) move towards Sprite 002 (blue box)
This can be done with MOVEMENT USING FORCES → Add a force to move towards a position
specifying X position , Y position and Speed. But this does not work with objects that have Physics2 applied to them.
Objects that have the physics behavior need to use physics actions for things like force and collision. They have the little atom⚛️before them.
You can apply force to a position using a point on the object to apply the force. Usually the center or mass center otherwise it will wobble.
Moveable object can’t be set to static. If you were making a billards game then you could set the gravity scale of the object’s behavior to zero.
https://wiki.gdevelop.io/gdevelop5/behaviors/physics2/
A screenshot of your force events and the behavior’s settings would help.
The length is the amount of force. The higher the number the more force.
(The N stands for Newtons. using Google: 1 newton of force is the force required to accelerate an object with a mass of 1 kilogram 1 meter per second per second.)
X and Y position is the target X,Y
Applying position is the point where the force is applied. Either the center or the mass center. It’s similar to where you would hit a golf ball or billiards ball but in 2 dimensions. If it’s not center it can add a wobble or set it off in another direction.
Thanks you.
Happened.