MCPcopy Index your code
hub / github.com/g3n/engine / ShowContact

Function ShowContact

experimental/physics/debug.go:71–92  ·  view source on GitHub ↗
(scene *core.Node, contact *collision.Contact)

Source from the content-addressed store, hash-verified

69}
70
71func ShowContact(scene *core.Node, contact *collision.Contact) {
72
73 vertices := math32.NewArrayF32(0, 16)
74
75 size := float32(0.0005)
76 otherPoint := contact.Point.Clone().Add(contact.Normal.Clone().MultiplyScalar(-contact.Depth))
77 vertices.AppendVector3(contact.Point.Clone().SetX(contact.Point.X - size))
78 vertices.AppendVector3(contact.Point.Clone().SetX(contact.Point.X + size))
79 vertices.AppendVector3(contact.Point.Clone().SetY(contact.Point.Y - size))
80 vertices.AppendVector3(contact.Point.Clone().SetY(contact.Point.Y + size))
81 vertices.AppendVector3(contact.Point.Clone().SetZ(contact.Point.Z - size))
82 vertices.AppendVector3(contact.Point.Clone().SetZ(contact.Point.Z + size))
83 vertices.AppendVector3(contact.Point.Clone())
84 vertices.AppendVector3(otherPoint)
85
86 geom := geometry.NewGeometry()
87 geom.AddVBO(gls.NewVBO(vertices).AddAttrib(gls.VertexPosition))
88
89 mat := material.NewStandard(&math32.Color{0, 0, 1})
90 faceGraphic := graphic.NewLines(geom, mat)
91 scene.Add(faceGraphic)
92}

Callers 1

ConvexConvexMethod · 0.85

Calls 14

AppendVector3Method · 0.95
AddVBOMethod · 0.95
NewArrayF32Function · 0.92
NewGeometryFunction · 0.92
NewVBOFunction · 0.92
NewStandardFunction · 0.92
NewLinesFunction · 0.92
CloneMethod · 0.65
AddMethod · 0.45
MultiplyScalarMethod · 0.45
SetXMethod · 0.45
SetYMethod · 0.45

Tested by

no test coverage detected