Gravity
in
Programming Questions
•
1 years ago
I've been asking a lot of questions, but I don't think there's a limit... I'm looking for something that looks like gravity, not an actual scientific formula, unless you think that is the best thing to use. Anyways what I like to do is:
xm=xm+(x-mouseX)/100;
ym=ym+(y-mouseY)/100;
Where xm is the variable that is added to x, and the same for y. But the problem with this is that the farther an object is, the stronger the effect of the "gravity" is, instead of the other way around. It seems like the answer should be obvious but, uh, I haven't thought of one.
xm=xm+(x-mouseX)/100;
ym=ym+(y-mouseY)/100;
Where xm is the variable that is added to x, and the same for y. But the problem with this is that the farther an object is, the stronger the effect of the "gravity" is, instead of the other way around. It seems like the answer should be obvious but, uh, I haven't thought of one.
1