Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Current Lagcompensator:
Supports box colliders,
Supports position & scale compensation.
Supports primitive movement systems.
Uses performance intensive methods. (addcomponent, destroy, instantiate, raycast)
Easy to script.
Very easy to implement.
Revamped Lagcompensator:
Supports any 3d collider type, including ragdoll rigs.
Supports position, rotation, and animation compensation.
Supports complex movement systems.
Optimized.
Easy to script.
May need refactoring to implement.
Animation Tracking & Compensation has been added. Note that it doesn't track or compensate for Blend Tree variables, that would be very hard to automate. you would have to manually set these in the compensated animator via script. OR edit the Lagcompensator to implement & interpolate these in Capture3d.
Usage is pretty simple, create dummy player with only trigger colliders. parent said dummy and the actual player under a main player GameObject. (may need refactoring). There's probably be a way to do this without parenting, not sure. Make sure to disable this by default, as it will be enabled when necessary by the server.
then just fill in the "tracked" fields with your actual player, and "compensated" fields with dummy player. the separated position / orientation variables are there for more complex player movement systems.
Animator compensation is optional.
Now you have 2 options for implementation, The first and easier version, await
UpdateColliders()
. you just put this before you Raycast in your servers Fire function. This also awaits a task inside of the function, not sure if its redundant.Second and more performant option,
UpdateTargetCollider()
andDisableColliders()
work together.DisableColliders()
goes at the end of your servers fire function. ThenUpdateTargetColldier
gets called if the client hits a player with their local raycast. NOT the server. i think the best way to add this is to add aNetworkConnectionToClient target
to your servers fire function, then callingawait UpdateTargetColldier(target)
before your servers raycast, if the target is not null.