Thin collider shape passes through HeightfieldColliderShape
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 7.8k
- Forks
- 1.2k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 49
Description
Release Type: GitHub
Version: master (4.0.0.1-beta03)
Platform(s): Windows
Describe the bug
Thin collider shape passes through HeightfieldColliderShape sometimes.
Even CCD can't seem to fix it.
To Reproduce
-
Create new project from TopDownRPG sample.
-
Remove the Platform folder in the MainScene.
-
Add new entity as Ground.
-
Add StaticColliderComponent to the Ground entity.
Colliderion group: CustomFilter1 -
Add Heightfield to the Collider Shapes.
Source: Float -
Add CountScript to the Ground entity.
public class CountScript : AsyncScript
{
public class TriggerScript : AsyncScript
{
public int Count = 0;
public override async Task Execute()
{
var trigger = new StaticColliderComponent
{
ProcessCollisions = true,
IsTrigger = true,
CollisionGroup = CollisionFilterGroups.DefaultFilter,
};
trigger.ColliderShapes.Add(new BoxColliderShapeDesc
{
Size = new Vector3(64, 10, 64),
LocalOffset = new Vector3(0, -8, 0),
});
Entity.Add(trigger);
while (Game.IsRunning)
{
await trigger.NewCollision();
Count++;
}
}
}
public override async Task Execute()
{
var triggerScript = new TriggerScript();
Entity.Add(triggerScript);
while(Game.IsRunning)
{
await Script.NextFrame();
DebugText.Print($"Count : { triggerScript.Count }", new Int2(10));
}
}
}
-
Remove Trigger, Rigidbody and LootCoinScript from CoinGold entity of LootGoldCoin prefab asset.
-
Set Transform.Position.Z of Camera entity to 20.
-
Run the game and punch LootBoxes.
Some coins pass through the Heightfield.
Expected behavior
All coins don't pass through the Heightfield.
Screenshots
Log and callstacks
Additional context
#494(Additional context)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue in the TopDownRPG sample using the MainScene changes, CountScript, LootGoldCoin prefab, and HeightfieldColliderShape described in the report. Start by isolating the collision behavior between the thin coin collider and the heightfield, including with CCD enabled. Done means repeated runs show that no coins pass through the HeightfieldColliderShape.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100