## NewtonBodySetFreezeState freeze several bodies

Report any bugs here and we'll post fixes

Moderators: Sascha Willems, Thomas

### NewtonBodySetFreezeState freeze several bodies

Why calling the NewtonBodySetFreezeState(body, 0) is also freezing the bodies that was touched before by this body ?

in dgBody::Freeze all the sons of master node are freezed and the same in unfreeze function.

If I understand correctly masterNode is the list of collided nodes.
but why freezing the collided nodes too ? maybe it's needed for unfreeze but i'm not sure about the freeze method.

or maybe the masterNode is not up to date when the collisions ends ?
arkeon

Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

### Re: NewtonBodySetFreezeState freeze several bodies

It need to do that because a body is considered to be part of a contraction if it is connected to any other body by a joint.
a frozen body is the union of all connected body of a contraction, this excludes static and kenmatic bobbies which are always frozen.
Julio Jerez
Moderator

Posts: 11045
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

### Re: NewtonBodySetFreezeState freeze several bodies

In my case if a body touch an another body.
then do not touch anymore and it is forced to freeze state. (when I hide the mesh for example)

the last touched bodies just freeze too. but there is no more association with the frozen body that collide before.

I've also noticed that when a body reach an equilibrium state in the air and that a collision happen in the same time, the two bodies rest in the air ^^

I think there is some cases missing.
arkeon

Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm

### Re: NewtonBodySetFreezeState freeze several bodies

in Original a body Newton never freezes in the air, I do not know why you are getting that.
you should no for bodied to freeze state by hand and expect the engine behave the way you think is would do.
Freeze state freezes an entire set of o dynamics bodies that are connected by joints.

In newton when a body touches any other body the entire island become awaken because of eth rule that a alive body is also the or combination of all alive bodies on a contraction.

a body reach equilibrium when it acceleration and it velocity is below a small threshold, or when the
velocity is low but the acceleration is oscillating between tow small values for a period of time, a boby should never freeze on a state that is not in equilibrium, like when a body is in mid air because it acceleration will always be large.

I am not sure why you get these problems, auto sleep should handle these situation automatically
if you want to single out a body of a group of body form the simulation (hiding)
you need to use a different set of function
Code: Select all
`void  NewtonBodyEnableSimulation(const NewtonBody* const body);void  NewtonBodyDisableSimulation(const NewtonBody* const body);`
Julio Jerez
Moderator

Posts: 11045
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

### Re: NewtonBodySetFreezeState freeze several bodies

hmm ok thanks, I'll change that.
arkeon

Posts: 261
Joined: Sat Sep 13, 2014 5:25 pm