JernejL wrote:if you can explain a bit further
- Code: Select all
float duration = timestep * 10; // duration until we hit the target
vec targetLinvel = (targetPosition - currentPosition) / duration;
vec curLinvel = BodyGetVelocity (body);
// may be still too aggressive - eventually try to smooth it: targetLinvel = targetLinvel * 0.1 + curLinvel * 0.9;
vec force = (targetLinvel - curLinvel) * mass; // this is important: if targetV already equals curV, nothing will happen
// add and adjust this if it seems to work til here: force.SetMaxLength(someConstant);
Angular part would be the same, but i'd focus on linear first.
One problem is that this ignores friction with ground. It might be a interesting option to fake contact velocity in contact callback instead forces in force callback, or use both approaches depending on contact situation.
Shaderman wrote:What about the good old client/server model?
Would this really work for realtime action games? I don't believe, but i totally don't know.
Liked this article: https://www.gamedev.net/articles/programming/networking-and-multiplayer/the-poor-mans-netcode-r4851/