[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29865] branches/soc-2010-aligorith-2/ source/blender/blenkernel/intern/rigidbody.c: Bullet SoC - Sim Loop Tweaks

Joshua Leung aligorith at gmail.com
Fri Jul 2 06:16:29 CEST 2010


Revision: 29865
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29865
Author:   aligorith
Date:     2010-07-02 06:16:28 +0200 (Fri, 02 Jul 2010)

Log Message:
-----------
Bullet SoC - Sim Loop Tweaks

Removed the special skip-everything case for timestep=0 case, since this resulted in jumpy and seemingly erratic results. Better just run the sim normally in this case for now. Later, it might be possible to use the cached results too or instead.

Modified Paths:
--------------
    branches/soc-2010-aligorith-2/source/blender/blenkernel/intern/rigidbody.c

Modified: branches/soc-2010-aligorith-2/source/blender/blenkernel/intern/rigidbody.c
===================================================================
--- branches/soc-2010-aligorith-2/source/blender/blenkernel/intern/rigidbody.c	2010-07-02 03:11:10 UTC (rev 29864)
+++ branches/soc-2010-aligorith-2/source/blender/blenkernel/intern/rigidbody.c	2010-07-02 04:16:28 UTC (rev 29865)
@@ -561,9 +561,12 @@
 	printf("\n");
 	
 	
-	/* only update if time changed (to avoid problems with velocities getting distorted) */
-	if (timestep > 0) {
-		/* step simulation by the requested timestep */
+	/* perform appropriate updates */
+	if (timestep >= 0) {
+		/* step simulation by the requested timestep 
+		 *	- stepping by timestep = 0 doesn't affect/skew velocities, 
+		 * 	  so this step should be fine
+		 */
 		rbStepSimulation(rbw->physics_world, timestep);
 		
 		/* grab current scene settings from the physics world */
@@ -579,7 +582,7 @@
 				// TODO: need to implement code to only grab certain components from this result...
 				rbGetTransformMatrix(rbo->physics_object, ob->obmat);
 				
-				// TODO: write new matrix to motion cache...
+				// TODO: write new matrix to motion cache for potential restoring later
 				
 				// DEBUG
 				printf("\t%s: new pos - %f %f %f \n", ob->id.name+2, ob->obmat[3][0], ob->obmat[3][1], ob->obmat[3][2]);
@@ -595,15 +598,6 @@
 		printf("\tTODO: read back from motion cache not implemented yet\n");
 		// xxx!
 	}
-	else {
-		printf("\ttimestep hasn't changed... skipping\n");
-		
-		// DEBUG
-		for (go = rbw->group->gobject.first; go; go = go->next) {
-			Object *ob = go->ob;
-			printf("\t%s: cur pos - %f %f %f \n", ob->id.name+2, ob->obmat[3][0], ob->obmat[3][1], ob->obmat[3][2]);
-		}
-	}
 	
 	/* perform tidy-up actions */
 	rbw->recalc = 0;





More information about the Bf-blender-cvs mailing list