# Federico Barlotti

Member

37

192 Neutral

• Rank
Member

• Interests
Programming
1. ## Make This Motion Fps-Independent?

Yeah, it seems like it's the most stable one out of the 326 I've tried. Thanks for the input though! Still very useful if one can do it that way. :)
2. ## Make This Motion Fps-Independent?

Ah, I missed that. Well, as I said earlier I can't do that unfortunately. I can only interpolate the current position over the friction, the destination and the delta. This is because the destination is variable at any point in time.
3. ## Make This Motion Fps-Independent?

I don't know, but that's the result I got. Maybe I've implemented it wrong. Here's my function:   void Entity::updatePos(float delta) { float3 distance = this.destination - this.position; float timeNeeded = 3.0f; float increment = delta / timeNeeded; this.X += increment; this.X = clamp(X, 0.0f, 1.0f); this.position += distance * this.X; ... }   I know for a fact the destination is updated correctly, so no problem there.
4. ## Make This Motion Fps-Independent?

Sorry, I must have misread your post.   But surely this is what you'd want in a game? Shouldn't traveling x distance always take the same amount of time, and not depend on whether your computer is awesome or not? With a varying frame rate, a varying distance moved per frame would have to be the case in order to compensate, in order to keep the total time equal.   It feels like I'm missing something -- care to explain?     Exactly! The way your approach (and my previous attempts) worked, the framerate did nothing to mitigate the wobbling of the movements. In other words, it would abnormally speed up when the framerate increased and slow down when it decreased. This should not happen.
5. ## Make This Motion Fps-Independent?

Your approach doesn't work. The effect is exactly the same I've been getting all along - i.e., speed changing based on the framerate, in fact it seems even worse than a couple of cases I was able to obtain.
6. ## Make This Motion Fps-Independent?

Thank you so much! This is much, much better than any of my results. It's still not perfect, probably due to my cheap framerate calculation, but it's barely noticeable. This is more than enough for my needs. :)
7. ## Make This Motion Fps-Independent?

I'm assuming elapsedTime is my delta time, but what are t and dt? Is one of them my X factor?   There is no origin and no time management in my system, maybe I've not been clear enough. I only have these factors, run on a frame by frame basis, with no "origin" or "time until B" etc.   I just have to put my delta time in the equation I've already got for it to work.
8. ## Make This Motion Fps-Independent?

I'm talking about my formula. position = position + (destination - position) * X; It lacks the delta time, and I don't know where to put it.
9. ## Make This Motion Fps-Independent?

You're confusing my X with the fixed delta time described in the article (which I did read, yet is unhelpful to my more specific problem). X is not the delta time, it's a "friction" factor. It doesn't change over time, but the approach should work for any X.   Also, quoting from the article:     I'm not going for this approach. As I said, the formula should be able to correctly interpret virtually any framerate and factor values between 0.0f and 1.0f.   So asking again, where does my delta time fit in in the operation?
10. ## Make This Motion Fps-Independent?

I have a position point that moves towards a destination point by a factor of:  position = position + distance * X; where: distance = destination - position; and X is a factor chosen by the code between 0.0f and 1.0f (0 = stopped and 1 = instantaneous motion);   And it all works fine, except the motion speeds up and slows down depending on the framerate. I have access to the delta time of the frames, but I have no idea how to fit it in the formula. I've tried many combinations and failed.   Any help?

That sounds interesting. The VS graphics diagnostics didn't work on VS 2013 so I ditched it and downloaded VS 2015, but since the GPU kept crashing I moved along and started working on the hlsl shaders instead. My card is an Nvidia GTX 970 (latest drivers), maybe it's D3D9 compatible.

Ah, I forgot I had it on; the output says nothing when it works, but when it doesn't or if I pause and continue, it loops that it needs at least one active vertex shader to work and there is currently none set in the context, and then the GPU crashes.

There is no SetShader call active anywhere in the code, so it's most probably the second one.   And I know that isn't the way it's supposed to be done, I was just wondering why it just so happened to work magically like that.

They both return a null pointer, and for some reason now the GPU sometimes crashes when I attempt to start the program or resume it after pausing the debug... I'm not gonna attempt to run it without a shader anymore though, since the GPU apparently can't recover if it crashes a second time (thus requiring me to reboot). Maybe my GPU is just weird, I dunno.   Now, onto new and painful issues, since I just can't get the matrix buffer to be accepted by the shader...