Skip to content

Add NetworkArea nodes as physics extras #451

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

kumpmati
Copy link
Contributor

@kumpmati kumpmati commented Apr 29, 2025

Related to #437

Physics rollback messes with Area2/3D entered and exited signals, making them fire multiple times, especially with ping + CharacterBodies.

The NetworkArea2/3D helper nodes introduce rollback-aware versions of Area2/3D signals and methods with a rollback_ prefix.

TODO:

  • Documentation
  • Test with Jolt
  • Test with Rapier (has issues)
  • Test with Godot Physics
  • Implement Area2/3D methods with rollback support

@MordikeyeNRigby
Copy link

o

I will test this right now with godot physics stepping

@CardboardCarl
Copy link

I'll test this out with rapier when I get a second

@kumpmati
Copy link
Contributor Author

kumpmati commented May 5, 2025

I will test this right now with godot physics stepping

I'll test this out with rapier when I get a second

Thank you both! 🚀
If you haven't tested the code yet, here's an example repo I made to help test out issues with the different engines.

https://github.com/kumpmati/netfox-physics-rollback-test

NetworkTime.on_tick.connect(_tick)


func _tick(_d: float, tick: int):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This runs in the tick loop, yet the signals emitted are labeled as rollback. Could you please clarify?

@elementbound
Copy link
Contributor

@kumpmati is the example repo still up? I can't open it.

@kumpmati
Copy link
Contributor Author

@kumpmati is the example repo still up? I can't open it.

Sorry I had made it private, it's now public again

Copy link
Contributor Author

@kumpmati kumpmati left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some things I should do still



## Returns the result of [method Area3D.get_overlapping_areas] at [param tick]
func rollback_get_overlapping_areas(tick: int) -> Array[Area3D]:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Godot can't automatically cast the values, so we need to either remove the type or use Array.assign

Suggested change
func rollback_get_overlapping_areas(tick: int) -> Array[Area3D]:
func rollback_get_overlapping_areas(tick: int) -> Array:

return _overlapping_areas.get_snapshot(tick) if _overlapping_areas.has(tick) else []

## Returns the result of [method Area3D.get_overlapping_bodies] at [param tick]
func rollback_get_overlapping_bodies(tick: int) -> Array[Node3D]:
Copy link
Contributor Author

@kumpmati kumpmati Jun 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here and in the 2D version

Suggested change
func rollback_get_overlapping_bodies(tick: int) -> Array[Node3D]:
func rollback_get_overlapping_bodies(tick: int) -> Array:



## Returns the result of [method Area3D.get_overlapping_areas] at [param tick]
func rollback_get_overlapping_areas(tick: int) -> Array[Area3D]:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also check if the area monitoring is set to true before trying to access overlapping bodies/areas

@elementbound
Copy link
Contributor

Some things I should do still

No worries @kumpmati, take your time! I think this will be another great addition to netfox's featureset, so I don't mind waiting a bit 😄 Let me know if there's anything I can help with, I'm happy to write the docs!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants