MCPcopy Create free account
hub / github.com/egonelbre/exp / SetProps

Function SetProps

physicscompress2/physics/encoding.go:179–202  ·  view source on GitHub ↗
(cur []Cube)

Source from the content-addressed store, hash-verified

177}
178
179func SetProps(cur []Cube) func(i int, v int) {
180 N := len(cur)
181 return func(i int, v int) {
182 k := i % N
183 switch i / N {
184 case 0:
185 cur[k].Pos.X = float32(v) / UnitsPerMeter
186 case 1:
187 cur[k].Pos.Y = float32(v) / UnitsPerMeter
188 case 2:
189 cur[k].Pos.Z = float32(v) / UnitsPerMeter
190 case 3:
191 cur[k].Rot.X = float32(v) / UnitsPerQuat
192 case 4:
193 cur[k].Rot.Y = float32(v) / UnitsPerQuat
194 case 5:
195 cur[k].Rot.Z = float32(v) / UnitsPerQuat
196 case 6:
197 cur[k].Rot.W = float32(v) / UnitsPerQuat
198 default:
199 panic("invalid")
200 }
201 }
202}
203
204func DeltaProps(hist, base []Cube) func(i int) int {
205 N := len(base)

Callers 1

DecodeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected