You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Sleep force the body not grouped with any other sleeping bodies to sleep immediately.
646
+
func (body*Body) Sleep() {
647
+
body.SleepWithGroup(nil)
648
+
}
649
+
650
+
// SleepWithGroup force the body to sleep immediately.
651
+
func (body*Body) SleepWithGroup(group*Body) {
652
+
assert(body.GetType() ==BODY_DYNAMIC, "Non-dynamic bodies cannot be put to sleep.")
653
+
654
+
assert(!body.space.IsLocked(), "Bodies cannot be put to sleep during a query or a call to Space.Step(). Put these calls into a post-step callback.")
655
+
assert(body.space.SleepTimeThreshold<INFINITY, "Sleeping is not enabled on the space. You cannot sleep a body without setting a sleep time threshold on the space.")
656
+
assert(group==nil||group.IsSleeping(), "Cannot use a non-sleeping body as a group identifier.")
657
+
658
+
ifbody.IsSleeping() {
659
+
assert(body.ComponentRoot() ==group.ComponentRoot(), "The body is already sleeping and it's group cannot be reassigned.")
0 commit comments