physics-logic

Provides Unity physics functionalities including Rigidbody dynamics, collision and trigger detection, layer filtering, raycast and OverlapSphere queries for C#12 on Unity 6+.

71|11|Updated Jan 23, 2026
One-click install
npx skills add https://github.com/nlelouche/Unity-SkillForge --skill physics-logic-nlelouche
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: physics-logic
Source: https://github.com/nlelouche/Unity-SkillForge/tree/main/.agent/skills/02-gameplay/physics-logic
Command: npx skills add https://github.com/nlelouche/Unity-SkillForge --skill physics-logic-nlelouche

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a comprehensive toolkit for implementing and managing Unity's physics systems, ensuring efficient and accurate interactions within your game world.

Core Features & Use Cases

  • Physics Queries: Perform raycasts, overlap checks, and spherecasts for detection and targeting.
  • Collision & Trigger Handling: Differentiate and manage physical collisions versus trigger events.
  • Layer Management: Optimize physics interactions by effectively using layers and LayerMasks.
  • Use Case: Implement a character's ground check, detect enemies within a radius, or create a weapon's hitscan functionality.

Quick Start

Use the physics-logic skill to perform a raycast to detect enemies within 10 units on the 'Enemy' layer.

Frequently Asked Questions about physics-logic

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I perform a raycast in Unity to detect enemies within a specific radius?

You can perform a Unity raycast to detect enemies by using physics queries like Raycast or OverlapSphere combined with LayerMasks to filter targets on the 'Enemy' layer within a specified distance.

What is the difference between collision and trigger detection in Unity rigidbody dynamics?

Unity collision detection generates physical bounce responses between rigidbodies, whereas trigger detection allows overlapping rigidbodies to pass through each other while still firing intersection events for gameplay logic.

How do I optimize Unity physics layer interactions to reduce unnecessary collision checks?

You optimize Unity physics interactions by configuring LayerMasks to filter queries and collisions, ensuring raycasts and rigidbody overlaps only evaluate relevant layers, reducing computational overhead in your game world.

Does this Unity physics engine toolkit support zero garbage collection allocations during gameplay?

Yes, the Unity physics toolkit targets zero garbage collection allocations in hot paths, ensuring efficient rigidbody dynamics and physics query execution without generating memory overhead during active gameplay.

Can I use these Unity physics scripts with C# 12 and Unity 6?

Yes, the Unity physics scripts fully support Unity 6 and above with C# 12, providing template scripts for common physics operations like ground checks, hitscan weapons, and enemy radius detection.

Why does my Unity OverlapSphere query fail to detect specific rigidbody objects?

A Unity OverlapSphere query fails when the target rigidbody objects are not assigned to the layers included in your LayerMask filter, or when the objects lack the required colliders for physical detection.