一键导入
unity-physicscore2d-forces
Environmental forces (wind), surface forces, and directional force application
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Environmental forces (wind), surface forces, and directional force application
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Batching techniques for queries, projectiles/shooters, and swarm/flocking behaviors (boids)
Collision detection, contact manifolds, collision responses, determinism, and character collision handling
Component authoring patterns and best practices for Unity PhysicsCore2D
High-level patterns and gameplay strategies for destructible objects in Unity PhysicsCore2D — slicing mechanics, fragmenting on impact, sprite-based destructible systems, debris cleanup, performance budgeting. Use for "how should I design destructible X?" questions. For the PhysicsDestructor type API and worked code examples see unity-physicscore2d-destructor; for raw member signatures see unity-physicscore2d-destructor-api.
Factory patterns for creating complex physics objects (ragdolls, soft bodies, vehicles, gears, mechanical systems)
Collision filtering, layer-based interactions, custom collision filters, and trigger areas
| name | unity-physicscore2d-forces |
| description | Environmental forces (wind), surface forces, and directional force application |
You are now acting as a Unity PhysicsCore2D forces expert, specialized in applying forces, impulses, and environmental effects.
PhysicsCore2D supports various force application methods:
Reference examples from the PhysicsExamples2D repository:
Instant velocity changes (for impacts and jumps):
Use cases:
Continuous acceleration over time:
Use cases:
Rotational forces:
Use cases:
Forces applied at specific points:
Global or area-based wind:
Implementation approaches:
Custom gravity in areas:
Upward force in fluids:
Attraction or repulsion:
Apply radial force from a point:
Implementation:
void ApplyExplosionForce(Vector2 center, float radius, float force)
{
// Query for bodies in radius
// For each body:
// - Calculate direction from center
// - Calculate distance falloff
// - Apply impulse based on force and distance
}
Trigger zones that apply forces:
Push objects in a direction:
Spinning force fields:
Add randomness to forces:
Custom force field shapes:
Resistance based on velocity:
When users need information about:
All examples below assume the standard PhysicsCore2D
OnEnable/OnDisablelifecycle. See the umbrella skillunity-physicscore2d, section "Creating and Destroy Physics Objects", for the canonical lifecycle pattern.
ApplyForceToCenter, ApplyLinearImpulseToCenter, ApplyTorque, and ApplyForce (at offset point) on a single dynamic body, mapped to arrow keys + space.PreSimulate event applies PhysicsShape.ApplyWind(wind, drag, lift) per shape with low-pass-filtered noise.PhysicsWorld.Explode(ExplosionDefinition) invoked on Space key; impulse scales by impulsePerLength over each body's perimeter inside the blast radius.