MCPcopy Create free account
hub / github.com/ByteArena/box2d / ApplyLinearImpulseToCenter

Method ApplyLinearImpulseToCenter

DynamicsB2Body.go:425–438  ·  view source on GitHub ↗
(impulse B2Vec2, wake bool)

Source from the content-addressed store, hash-verified

423}
424
425func (body *B2Body) ApplyLinearImpulseToCenter(impulse B2Vec2, wake bool) {
426 if body.M_type != B2BodyType.B2_dynamicBody {
427 return
428 }
429
430 if wake && (body.M_flags&B2Body_Flags.E_awakeFlag) == 0 {
431 body.SetAwake(true)
432 }
433
434 // Don't accumulate velocity if the body is sleeping
435 if (body.M_flags & B2Body_Flags.E_awakeFlag) != 0x0000 {
436 body.M_linearVelocity.OperatorPlusInplace(B2Vec2MulScalar(body.M_invMass, impulse))
437 }
438}
439
440func (body *B2Body) ApplyAngularImpulse(impulse float64, wake bool) {
441 if body.M_type != B2BodyType.B2_dynamicBody {

Callers

nothing calls this directly

Calls 3

SetAwakeMethod · 0.95
B2Vec2MulScalarFunction · 0.85
OperatorPlusInplaceMethod · 0.45

Tested by

no test coverage detected