mirror of
https://github.com/bulletphysics/bullet3.git
synced 2026-09-20 01:04:29 +00:00
Merge pull request #2809 from erwincoumans/master
add pybullet.unsupportedChangeScaling feature for some small experime…
This commit is contained in:
@@ -8063,7 +8063,9 @@ bool PhysicsServerCommandProcessor::processRequestContactpointInformationCommand
|
||||
|
||||
cb.m_bodyUniqueIdA = bodyUniqueIdA;
|
||||
cb.m_bodyUniqueIdB = bodyUniqueIdB;
|
||||
cb.m_deltaTime = m_data->m_physicsDeltaTime;
|
||||
cb.m_deltaTime = m_data->m_numSimulationSubSteps>0 ?
|
||||
m_data->m_physicsDeltaTime/ m_data->m_numSimulationSubSteps :
|
||||
m_data->m_physicsDeltaTime;
|
||||
|
||||
for (int i = 0; i < setA.size(); i++)
|
||||
{
|
||||
@@ -10047,6 +10049,20 @@ bool PhysicsServerCommandProcessor::processInitPoseCommand(const struct SharedMe
|
||||
{
|
||||
btMultiBody* mb = body->m_multiBody;
|
||||
|
||||
if (clientCmd.m_updateFlags & INIT_POSE_HAS_SCALING)
|
||||
{
|
||||
btVector3 scaling(clientCmd.m_initPoseArgs.m_scaling[0], clientCmd.m_initPoseArgs.m_scaling[1], clientCmd.m_initPoseArgs.m_scaling[2]);
|
||||
|
||||
mb->getBaseCollider()->getCollisionShape()->setLocalScaling(scaling);
|
||||
//refresh broadphase
|
||||
m_data->m_dynamicsWorld->getBroadphase()->getOverlappingPairCache()->cleanProxyFromPairs(
|
||||
mb->getBaseCollider()->getBroadphaseHandle(),
|
||||
m_data->m_dynamicsWorld->getDispatcher());
|
||||
//also visuals
|
||||
int graphicsIndex = mb->getBaseCollider()->getUserIndex();
|
||||
m_data->m_guiHelper->changeScaling(graphicsIndex, clientCmd.m_initPoseArgs.m_scaling);
|
||||
}
|
||||
|
||||
if (clientCmd.m_updateFlags & INIT_POSE_HAS_BASE_LINEAR_VELOCITY)
|
||||
{
|
||||
mb->setBaseVel(baseLinVel);
|
||||
@@ -11605,6 +11621,10 @@ bool PhysicsServerCommandProcessor::processCreateUserConstraintCommand(const str
|
||||
|
||||
if (clientCmd.m_updateFlags & USER_CONSTRAINT_CHANGE_CONSTRAINT)
|
||||
{
|
||||
btScalar fixedTimeSubStep = m_data->m_numSimulationSubSteps > 0 ?
|
||||
m_data->m_physicsDeltaTime / m_data->m_numSimulationSubSteps :
|
||||
m_data->m_physicsDeltaTime;
|
||||
|
||||
serverCmd.m_type = CMD_CHANGE_USER_CONSTRAINT_FAILED;
|
||||
int userConstraintUidChange = clientCmd.m_userConstraintArguments.m_userConstraintUniqueId;
|
||||
InteralUserConstraintData* userConstraintPtr = m_data->m_userConstraints.find(userConstraintUidChange);
|
||||
@@ -11637,7 +11657,8 @@ bool PhysicsServerCommandProcessor::processCreateUserConstraintCommand(const str
|
||||
}
|
||||
if (clientCmd.m_updateFlags & USER_CONSTRAINT_CHANGE_MAX_FORCE)
|
||||
{
|
||||
btScalar maxImp = clientCmd.m_userConstraintArguments.m_maxAppliedForce * m_data->m_physicsDeltaTime;
|
||||
btScalar maxImp = clientCmd.m_userConstraintArguments.m_maxAppliedForce * fixedTimeSubStep;
|
||||
|
||||
userConstraintPtr->m_userConstraintData.m_maxAppliedForce = clientCmd.m_userConstraintArguments.m_maxAppliedForce;
|
||||
userConstraintPtr->m_mbConstraint->setMaxAppliedImpulse(maxImp);
|
||||
}
|
||||
@@ -11668,7 +11689,7 @@ bool PhysicsServerCommandProcessor::processCreateUserConstraintCommand(const str
|
||||
{
|
||||
if (clientCmd.m_updateFlags & USER_CONSTRAINT_CHANGE_MAX_FORCE)
|
||||
{
|
||||
btScalar maxImp = clientCmd.m_userConstraintArguments.m_maxAppliedForce * m_data->m_physicsDeltaTime;
|
||||
btScalar maxImp = clientCmd.m_userConstraintArguments.m_maxAppliedForce * fixedTimeSubStep;
|
||||
userConstraintPtr->m_userConstraintData.m_maxAppliedForce = clientCmd.m_userConstraintArguments.m_maxAppliedForce;
|
||||
//userConstraintPtr->m_rbConstraint->setMaxAppliedImpulse(maxImp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user