I’m making a game on where you character mainly moves around with a shotgun, which would propel you into higher places! My problem is the main pc I am working on seems to have the recoil/knockback exactly as I want it, but when i go onto other pcs it instead makes my character a lot more floatier and go higher than normal.
How would I fix this?
It sounds like the force applied is being affected by FPS. With Physics2 behavior I use “apply impulse” instead of “apply force” because impulses are instantaneous.
You could also use TimeDelta() to “unmarry” actions from the framerate
After testing it seems it is affected by fps
This is the Normal height I I get when my gun is looking at the floor when shot on 144 fps
and this on 60fps
The problem is that i don’t use Physics2, i had tried that before on a different issue and it created my problems then solved, if there is a different way to use Physics2 then I can try that. I also don’t know what TimeDelta() to “Unmarry” is
If you share your current events that implement the kick back, then someone can suggest how to fix it so it’s consistent on any device.
You could use TimeDelta() on the “Change the value of ForceVar: subtract 10
” action.
TimeDelta() returns the number of milliseconds that have passed since the last game frame, or when the event sheet was last run through. Most games run at 60FPS, so your 1600 initial ForceVar will decrease by about 600 per second - that’s the 10 you subtract from ForceVar every game frame.
So you want to change that last action in your screen shot to:
Change the variable ForceVar: subtract 600 * TimeDelta()
That should give you a consistent knockback distance regardless on the games FPS.
It works!!! THANK YOU!
Physics2 is really nice, but it is an entire movement system. It doesn’t integrate with any other behaviors (the opposite is true, other behaviors like DraggablePhysics are made specifically to work with it). So it is a good idea to decide at the beginning of development if you are going to use it or not. And if you do, take advantage of it as much as possible, and focus on learning to use the parameters to achieve the desired result as much as possible, rather than band-aids with events.
You can still move physics objects in other ways too, and you can detect collisions with non-physics objects the same way as before, you just have to be careful about when and how you do that or else you can get undesired results.