Hey there all, I’m having a bit of a problem that I have been trying to figure out for the last ~5 days, basically, I want an object to move by a specific amount using AddForce, for example, lets say 1 unit, however, when I use this snippet of code body.AddForce(new Vector3(1,0,0), ForceMode.Impulse); instead of moving it by 1 unit, so that the position is 1,0,0 It moves it by 0.03291207,0,0 so I realized that there is a calculation here, so I thought maybe for every 1 velocity, it moves it by 0.0329…, so I figured if I were to multiply the velocity by around 30, however, if I put body.AddForce(new Vector3(30,0,0), ForceMode.Impulse);, but now it moves it by 37.92695,0,0 , so I was really confused. So after making a spreadsheet and then copying and pasting different velocities and how they work, I finally figured it out. so it works a something a bit like this :
basically, there are 3 things, the input value [which we will call X], the velocity, and the position. the Velocity starts outs as the X, and every frame its decreased by - 0.2355
the position starts out as whatever position it is, and then there is a speed value, lets call it Y, now Y starts out as X divided by 100 and multiplied by 2, so for example if X is 1, Y would start out as 0.02, then, ~0.0048 is removed from Y, so now it’s 0.0152, and then every frame, the position is increased by the Y value, and also every frame, Y is being decreased by ~0.0048, ~0.0048 being the friction [I think].
and now that I knew how it worked, I could reverse engineer, and I did! so I figured out that to get the object to move by 1 unit, I needed to input around 5.02 velocity. So, you might be wondering if I figured it out, why am I posting it here? well, the problem arises when I try to move it on the Z-axis at the same time, like body.AddForce(new Vector3(1,0,1), ForceMode.Impulse); now it moves it by on both axis by 0.0500636, 0, 0.0500636 instead of 0.03291207,0,0.03291207. So this really made me confused, so then I made a spreadsheet and then copied and pasted different velocities and how they work. And it turns out the formula is still the same, however, 0.2355 and 0.0048 are changed, for example when it’s body.AddForce(new Vector3(1,0,1), ForceMode.Impulse);, 0.0048 is actually 0.00332966 so Y is being decreased by 0.00332966 every frame, but if there are 2 different numbers, then, they both have different 0.0048’s, for example, if it’s body.AddForce(new Vector3(1,0,2), ForceMode.Impulse);. for 1 the value is 0.00210584 meaning Y gets decreased by 0.00210584 every frame, but for 2 in the same vector, 0.00421168 is the magic number, meaning Y is decreased by 0.00421168 every frame.
And that’s where I’m stuck, I can’t figure out where these numbers are coming from. I tried dividing it, multiplying it, subtracting and adding and I just cant figure it out. So I would really appreciate help from the physics experts here. Keep in mind that I don’t know that much about physics and only know a bit about algebra and stuff like that, so I have no idea what the correlations are. If anyone needs it, here is the table I made showcasing every “magic number” from 1 to 6, the colored squares are squares that are quite similar[ICODE][/ICODE]
Sorry if this post was a bit confusing, this whole topic is a bit confusing so I’m not sure if I explained it well enough, and I’m a bit tired, so if you didn’t understand anything just leave a comment and I will try to answer it, Thanks in advance for any help ![]()