<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
	<link rel="self" type="application/atom+xml" href="https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/12753" />

	<title>Real-Time Physics Simulation Forum</title>
	
	<link href="https://pybullet.org/Bullet/phpBB3/index.php" />
	<updated>2019-08-22T03:29:59+00:00</updated>

	<author><name><![CDATA[Real-Time Physics Simulation Forum]]></name></author>
	<id>https://pybullet.org/Bullet/phpBB3/app.php/feed/topic/12753</id>

		<entry>
		<author><name><![CDATA[ekcool]]></name></author>
		<updated>2019-08-22T03:29:59+00:00</updated>

		<published>2019-08-22T03:29:59+00:00</published>
		<id>https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=42337#p42337</id>
		<link href="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=42337#p42337"/>
		<title type="html"><![CDATA[Help!  softbody nodes can not update after stepsimulate]]></title>

		
		<content type="html" xml:base="https://pybullet.org/Bullet/phpBB3/viewtopic.php?p=42337#p42337"><![CDATA[
I follow SoftDemo,and create a btSoftRigidDynamicsWorld and create a softbody with trimesh from my mesh sucessuflly.<br>Details as follows:<br>1)<br>btDefaultSoftBodySolver* softSolver = new btDefaultSoftBodySolver();<br>btSequentialImpulseConstraintSolver* solver = new btSequentialImpulseConstraintSolver();<br>btSoftRigidDynamicsWorld* _sworld = new btSoftRigidDynamicsWorld(m_dispatcher, m_broadphase,solver, collisionConfig, softSolver);<br>m_dynamicsWorld = (btSoftRigidDynamicsWorld*)_sworld;<br>///setting here<br><br>m_dynamicsWorld-&gt;setGravity(btVector3(0, -9.8, 0));<br>m_dynamicsWorld-&gt;getDispatchInfo().m_useContinuous = true;<br>m_dynamicsWorld-&gt;getSolverInfo().m_erp2 = 0.f;<br>m_dynamicsWorld-&gt;getSolverInfo().m_globalCfm = 0.f;<br>m_dynamicsWorld-&gt;setSynchronizeAllMotionStates(true);<br>///////////////////////////////////fill softinfo for create softbody/////////////////////      m_softBodyWorldInfo.m_broadphase = m_broadphase;<br>m_softBodyWorldInfo.m_dispatcher = m_dispatcher;<br>m_softBodyWorldInfo.m_sparsesdf.Initialize();<br>m_softBodyWorldInfo.m_gravity.setValue(0, -9.8, 0);<br>m_softBodyWorldInfo.air_density = (btScalar)1.2;<br>m_softBodyWorldInfo.water_density = 0;<br>m_softBodyWorldInfo.water_offset = 0;<br>m_softBodyWorldInfo.water_normal = btVector3(0, 0, 0);<br><br>2)////create a softbody and add it into sofrigiddynamicsworld :<br>m_psb = btSoftBodyHelpers::CreateFromTriMesh(softBodyWorldInfo, meshVecs, indices, numTrigs);<br>if (m_psb == NULL)<br>assert(false);<br>btSoftBody::Material* pm = m_psb-&gt;appendMaterial();<br>pm-&gt;m_kLST = 0.1;<br><br>m_psb-&gt;transform(psbTrans);//this works well,it can move the softbody mesh location<br>m_psb-&gt;setTotalMass(5, true);<br>m_psb-&gt;m_cfg.kDP = 0.0;// Damping coefficient [0,1]<br>m_psb-&gt;m_cfg.kDF = /*0.2*/ 1.0;// Dynamic friction coefficient [0,1]<br>m_psb-&gt;m_cfg.kMT = 0.05;// Pose matching coefficient [0,1]<br>m_psb-&gt;m_cfg.kCHR = 1.0;// Rigid contacts hardness [0,1]<br>m_psb-&gt;m_cfg.kKHR = 0.1;// Kinetic contacts hardness [0,1]<br>m_psb-&gt;m_cfg.kSHR = 0.0;// Soft contacts hardness [0,1]<br>m_psb-&gt;m_cfg.collisions = btSoftBody::fCollision::SDF_RS + btSoftBody::fCollision::CL_SS + btSoftBody::fCollision::CL_SELF;<br>m_psb-&gt;m_cfg.piterations = 7;<br>m_psb-&gt;m_materials[0]-&gt;m_kLST = 1.0;<br>m_psb-&gt;m_materials[0]-&gt;m_kAST = 0.2;<br>m_psb-&gt;m_materials[0]-&gt;m_kVST = 1.0;<br>m_psb-&gt;setPose(true, true);<br>m_psb-&gt;generateBendingConstraints(2);<br>m_psb-&gt;randomizeConstraints();<br>3)////in my game loop I try to setupsimulate, and get softbody m_nodes' position to update my mesh vertices ,but failed :<br><br>         void SkinnedMeshRenderer::lateUpdate() //update for every frame<br>    {<br>        if (!_mesh)<br>        {<br>            return;<br>        }<br>if (_pWorld)<br>{<br>_pWorld-&gt;stepSimulate(1.0f / 60.0f);<br>this-&gt;updateVerticesFromSim();//get softbody nodes and update mesh vertices,but all nodes location's value had no changes <br>}<br>        this-&gt;updateBones();<br>        this-&gt;updateBlendShapes();<br><br>    }<br><br><br>so, reslut is showed as old state, the mesh cloth had no change ,anyone can give me an advice? thanks...<p>Statistics: Posted by <a href="https://pybullet.org/Bullet/phpBB3/memberlist.php?mode=viewprofile&amp;u=13392">ekcool</a> — Thu Aug 22, 2019 3:29 am</p><hr />
]]></content>
	</entry>
	</feed>
