Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add force step method to physics #20948

Closed
wants to merge 1 commit into from
Closed

Add force step method to physics #20948

wants to merge 1 commit into from

Conversation

RevenantX
Copy link

This method helps implementing best network FPS physics.

@akien-mga
Copy link
Member

CC @AndreaCatania

@pgruenbacher
Copy link

I don't follow the justification?

My guess is that instead of server.set_active(true); server.step(); server.set_active(false); you can do server.force_step() is what you want...

except the bound method step for the physics server has been commented ever since its open-source inception, so I'm guessing there's a reason step isn't being allowed to be called as a bound method.... and that reason would also apply to the force step...

@reduz
Copy link
Member

reduz commented Aug 14, 2018

I dont really understand how this would be used

@RevenantX
Copy link
Author

@pgruenbacher i tested this code and it works well.
@reduz like in unity3d - there is Physics.Simulate method. Very usable for client side prediction (you can freeze or rewind all physical objects and then resimulate some number of frames at one time)

@AndreaCatania
Copy link
Contributor

This could be useful but not in that way. When you need to sync physics you have to instantiate more then one physics space and "step" only it when necessary.

In the way you implemented it, the force step will force the processing of all spaces and not a particular one, and this is always wrong.

@RevenantX
Copy link
Author

RevenantX commented Aug 15, 2018

@AndreaCatania you can deactivate spaces before step. (or deactivate some bodies).
In many FPS games there is no much physics. Only on projectiles and players. So there is no sense add more "spaces" than one. You can just disable objects before step or make them kinematic (or rewind all states).
Look at https://docs.unity3d.com/ScriptReference/Physics.Simulate.html

@AndreaCatania
Copy link
Contributor

I don't know unity, but this is really depend on the kind of project and approach. But from Godot side advance all spaces all together has no sense.

So I would add an API that accept the space RID to be stepped.

@RevenantX
Copy link
Author

@AndreaCatania well thats usefull for my purposes too.

@AndreaCatania
Copy link
Contributor

@RevenantX why did you close it?

@RevenantX
Copy link
Author

@AndreaCatania because better will be create another pull request with "space" step?

@AndreaCatania
Copy link
Contributor

Usually we change the current commit, to keep a track of discussion. But it's not a problem do it in the way you are more comfortable.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants