Fix [#36847] If Force Field in Ridgid Body group, crash at first frame of animation on playback

Not all objects in RB group actually have a "rigid body object", needs to be checked.
This commit is contained in:
Bastien Montagne 2013-09-29 13:38:56 +00:00
parent 4829cf9cd0
commit af915b443a

@ -1166,7 +1166,7 @@ static void rigidbody_update_simulation_post_step(RigidBodyWorld *rbw)
if (ob) { if (ob) {
RigidBodyOb *rbo = ob->rigidbody_object; RigidBodyOb *rbo = ob->rigidbody_object;
/* reset kinematic state for transformed objects */ /* reset kinematic state for transformed objects */
if (ob->flag & SELECT && G.moving & G_TRANSFORM_OBJ) { if (rbo && (ob->flag & SELECT) && (G.moving & G_TRANSFORM_OBJ)) {
RB_body_set_kinematic_state(rbo->physics_object, rbo->flag & RBO_FLAG_KINEMATIC || rbo->flag & RBO_FLAG_DISABLED); RB_body_set_kinematic_state(rbo->physics_object, rbo->flag & RBO_FLAG_KINEMATIC || rbo->flag & RBO_FLAG_DISABLED);
RB_body_set_mass(rbo->physics_object, RBO_GET_MASS(rbo)); RB_body_set_mass(rbo->physics_object, RBO_GET_MASS(rbo));
/* deactivate passive objects so they don't interfere with deactivation of active objects */ /* deactivate passive objects so they don't interfere with deactivation of active objects */