Skip to content

Motivation behind mLinearCastThreshold #1445

Answered by jrouwe
mihe asked this question in Q&A
Discussion options

You must be logged in to vote

It's not only a performance optization, if you change SimpleTest to:

void SimpleTest::Initialize()
{
	CreateFloor();

	PhysicsSettings set = mPhysicsSystem->GetPhysicsSettings();
	//set.mLinearCastThreshold = 0; <--- UNCOMMENT THIS AND COMPARE WITH ORIGINAL
	mPhysicsSystem->SetPhysicsSettings(set);

	BodyCreationSettings bcs(new BoxShape(Vec3(0.5f, 1.0f, 2.0f)), RVec3(0, 10, 0), Quat::sRotation(Vec3::sAxisX(), 0.25f * JPH_PI), EMotionType::Dynamic, Layers::MOVING);
	bcs.mMotionQuality = EMotionQuality::LinearCast;	
	mBodyInterface->CreateAndAddBody(bcs, EActivation::Activate);
}

You can see the difference. Normal linear cast treshold:

normal.mp4

Setting it to zero:

zero.mp4

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mihe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants