بنقرة واحدة
collision
Enable contact detection using the correct contact material for NSC or SMC systems.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Enable contact detection using the correct contact material for NSC or SMC systems.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Quaternion creation, component access, and Euler angle conversion in PyChrono
Run the time-stepping loop, collect data, and post-process results with matplotlib or CSV.
Irrlicht visualization — visual shapes (mesh, line, spring), materials, GUI overlays, path rendering, and collision debug.
Create rigid bodies with mass, geometry, collision shapes, and visual assets.
Apply custom forces/torques to rigid bodies via accumulators, and impose prescribed motion or force between two bodies using ChLinkMotor classes. Covers axis-aware force/torque application and paired internal reactions.
Create and configure a PyChrono ChSystem, gravity, contact method, and solver.
| name | collision |
| description | Enable contact detection using the correct contact material for NSC or SMC systems. |
| compatibility | pychrono >= 8.0 |
| metadata | {"domain":"mbs"} |
Enable contact detection between bodies using the correct contact material for the system type (NSC or SMC), and attach collision shapes to bodies.
When bodies should interact physically through contacts (floors, walls, falling objects, mixers, etc.).
ChSystemNSC → use ChContactMaterialNSCChSystemSMC → use ChContactMaterialSMC
Mixing them causes silent errors or crashes.sys.SetCollisionSystemType(chrono.ChCollisionSystem.Type_BULLET)
This must be called once on the system before any bodies with collision are stepped.
friction = float # friction coefficient
restitution = float # restitution coefficient
mat = chrono.ChContactMaterialNSC()
mat.SetFriction(friction)
mat.SetRestitution(restitution)
# Sphere
sph_radius = float # sphere radius [m]
sph_density = float # sphere density [kg/m³]
sphere = chrono.ChBodyEasySphere(sph_radius, sph_density, True, True, mat)
sphere.SetPos(chrono.ChVector3d(x, y, z))
sys.Add(sphere)
# Box
box_sx = float # box width [m]
box_sy = float # box height [m]
box_sz = float # box depth [m]
box_density = float # box density [kg/m³]
box = chrono.ChBodyEasyBox(box_sx, box_sy, box_sz, box_density, True, True, mat)
sys.Add(box)
# Cylinder
cyl_radius = float # cylinder radius [m]
cyl_height = float # cylinder height [m]
cyl_density = float # cylinder density [kg/m³]
cyl = chrono.ChBodyEasyCylinder(chrono.ChAxis_Y, cyl_radius, cyl_height, cyl_density, True, True, mat)
sys.Add(cyl)
vis_mat = chrono.ChVisualMaterial()
vis_mat.SetKdTexture(chrono.GetChronoDataFile("textures/concrete.jpg"))
body.GetVisualShape(0).SetMaterial(0, vis_mat)
friction = float # friction coefficient
mat = chrono.ChContactMaterialSMC()
mat.SetFriction(friction)
# mat.SetYoungModulus(2e7) # optional
# mat.SetPoissonRatio(0.3) # optional
mass = float # body mass [kg]
radius = float # collision sphere radius [m]
body = chrono.ChBody()
body.SetMass(mass)
body.SetPos(chrono.ChVector3d(x, y, z))
# Add collision shape (SMC material embedded in shape)
shape = chrono.ChCollisionShapeSphere(mat, radius)
body.AddCollisionShape(shape)
body.EnableCollision(True)
# Add visual shape separately
sphere_vs = chrono.ChVisualShapeSphere(radius)
sphere_vs.SetTexture(chrono.GetChronoDataFile("textures/bluewhite.png"))
body.AddVisualShape(sphere_vs)
sys.AddBody(body)
chrono.ChCollisionShapeSphere(mat, radius)
chrono.ChCollisionShapeBox(mat, sx, sy, sz)
# Attach at offset: body.AddCollisionShape(shape, chrono.ChFramed(pos, rot))
| Scenario | Recommended |
|---|---|
| Rigid/hard impacts (balls, blocks) | NSC |
| Many simultaneous contacts (granular) | NSC |
| Soft/compliant contacts | SMC |
| Need continuous force (no impulsive) | SMC |