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

Method StepPlus

experimental/physics/simulation.go:192–228  ·  view source on GitHub ↗

Step steps the simulation. maxSubSteps should be 10 by default

(frameDelta float32, timeSinceLastCalled float32, maxSubSteps int)

Source from the content-addressed store, hash-verified

190// Step steps the simulation.
191// maxSubSteps should be 10 by default
192func (s *Simulation) StepPlus(frameDelta float32, timeSinceLastCalled float32, maxSubSteps int) {
193
194 if s.paused {
195 return
196 }
197
198 dt := frameDelta//float32(frameDelta.Seconds())
199
200 //if timeSinceLastCalled == 0 { // Fixed, simple stepping
201
202 s.internalStep(dt)
203
204 // Increment time
205 //s.time += dt
206
207 //} else {
208 //
209 // s.accumulator += timeSinceLastCalled
210 // var substeps = 0
211 // for s.accumulator >= dt && substeps < maxSubSteps {
212 // // Do fixed steps to catch up
213 // s.internalStep(dt)
214 // s.accumulator -= dt
215 // substeps++
216 // }
217 //
218 // var t = (s.accumulator % dt) / dt
219 // for j := 0; j < len(s.bodies); j++ {
220 // var b = s.bodies[j]
221 // b.previousPosition.lerp(b.position, t, b.interpolatedPosition)
222 // b.previousQuaternion.slerp(b.quaternion, t, b.interpolatedQuaternion)
223 // b.previousQuaternion.normalize()
224 // }
225 // s.time += timeSinceLastCalled
226 //}
227
228}
229
230// SetPaused sets the paused state of the simulation.
231func (s *Simulation) SetPaused(state bool) {

Callers 1

StepMethod · 0.95

Calls 1

internalStepMethod · 0.95

Tested by

no test coverage detected