Repository navigation
Don't cache the ground ray while standing on a mover - #1082
Open
pieterdeschepper wants to merge 2 commits into
Open
pieterdeschepper wants to merge 2 commits into
pieterdeschepper wants to merge 2 commits into
Conversation
MoveAlgo caches the ground ray by npc position, so an npc standing still on an elevator keeps the old ground height while the mover rises, and the platform passes through it. Mark bodies created by addMovableObj and skip the cache when the last ground hit was one of them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Hi, @pieterdeschepper ! Generally look nice, but can you please instead of using user-index3 add rather new kind of collision? Essentially split |
Movers get C_Movable instead of C_Object plus a user-index3 flag, since bullet user indices are limited. Everything that handles C_Object treats C_Movable the same way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
Done in 6f68e6c: movers now get their own collision category, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Part of #1050: a character standing still on an elevator isn't carried up. The platform rises through it instead.
MoveAlgo::rayMaincaches the ground ray by NPC position. While the NPC stands still on a mover, the cache keeps returning the old ground height, so the step-up code inimplTicknever runs.Change
This is the first half of the approach suggested in #1050 ("keep collision uncached, if ground is movable"):
addMovableObj(whatMoveTriggeruses) get a new collision category,C_Movable, instead ofC_Object. Everything that handledC_ObjecttreatsC_Movablethe same way.RayLandResult::movableis set when the hit body isC_Movable.rayMainskips the cache while the last ground hit was movable. The ground is then re-measured every tick, and the existing step-up code lifts the NPC with the platform. Nothing changes for NPCs on static ground or landscape, so the cache still applies everywhere else.Not covered
Testing
Gothic 1, Sleeper temple elevator (
EVT_TPL_12_ELEVATOR_01), macOS on an Apple M3 Pro. Standing still on the lowered block, the player now rides up with it instead of falling through. Walking, jumping and climbing elsewhere behaved normally.🤖 Generated with Claude Code