Why is mesh baking causing huge performance spikes?
Posted
by
jellyfication
on Game Development
See other posts from Game Development
or by jellyfication
Published on 2014-03-21T20:11:38Z
Indexed on
2014/08/20
4:32 UTC
Read the original article
Hit count: 1712
A couple of seconds into the gameplay on my Android device, I see huge performance spikes caused by "Mesh.Bake Scaled Mesh PhysX CollisionData"
In my game, a whole level is a parent object containing multiple ridigbodies with mesh colliders. Every FixedUpdate()
, my parent object rotates around the player.
Rotating the world causes mesh scaling. Here is the code that handles world rotation.
private void Update()
{
input.update();
Vector3 currentInput = input.GetDirection();
worldParent.rotation = initialRotation;
worldParent.DetachChildren();
worldParent.position = transform.position;
world.parent = worldParent;
worldParent.Rotate(Vector3.right, currentInput.x * 50f);
worldParent.Rotate(Vector3.forward, currentInput.z * 50f);
}
How can I get rid of mesh scaling ? Mesh.Bake physx seems to take effect after some time, is it possible to disable this function ?
The profiler looks like this:
Bottom-left panel shows data before spikes, the right after
© Game Development or respective owner