Skip to content

Don't share collision shapes between instances of platforms#51

Merged
manuq merged 2 commits into
mainfrom
platform-dont-share-collision-shapes
Nov 25, 2025
Merged

Don't share collision shapes between instances of platforms#51
manuq merged 2 commits into
mainfrom
platform-dont-share-collision-shapes

Conversation

@wjt
Copy link
Copy Markdown
Member

@wjt wjt commented Nov 24, 2025

Previously, the collision shapes were shared between each instance of the scene.

This means that if you placed 2 platforms in a scene, and set one of them to be 2 tiles wide and the other to 3 tiles wide, the collision shapes would both be as wide as the last platform in the scene tree, rather than matching their visible size.

Making the resources local_to_scene causes them to be duplicated when the scene is instanced.

wjt added 2 commits November 24, 2025 18:03
Loading and saving platform.tscn, without modification, causes these
changes to be written to disk. The platform width change is because the
default width in the script is 2 tiles, but the scene was set up for 3
tiles.
Previously, the collision shapes were shared between each instance of
the scene.

This means that if you placed 2 platforms in a scene, and set one of
them to be 2 tiles wide and the other to 3 tiles wide, the collision
shapes would both be as wide as the last platform in the scene tree,
rather than matching their visible size.

Making the resources local_to_scene causes them to be duplicated when
the scene is instanced.
@wjt wjt requested a review from a team as a code owner November 24, 2025 18:04
@github-actions
Copy link
Copy Markdown

Play this branch at https://endlessm.github.io/moddable-platformer/branches/endlessm/platform-dont-share-collision-shapes.

(This launches the game from the start, not directly at the change(s) in this pull request.)


[sub_resource type="RectangleShape2D" id="RectangleShape2D_i4vtk"]
size = Vector2(384, 40)
resource_local_to_scene = true
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

👍

@manuq manuq merged commit 0d110f3 into main Nov 25, 2025
6 checks passed
@manuq manuq deleted the platform-dont-share-collision-shapes branch November 25, 2025 12:47
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.

2 participants