Im using the “Example Vehicles” scripts as groundwork for my physics but whenever I try to use the smoke-effects i get a serious performance drop.
I go from 100fps to about 25-30!
Heres the code involved
// This is in FixedUpdate
for(w in wheels)
{
//rotate wheel
w.rotation += wheelRPM / 60.0 * 360.0* Time.fixedDeltaTime;
w.rotation = Mathf.Repeat(w.rotation, 360.0);
w.graphic.localRotation= Quaternion.Euler( w.rotation, w.maxSteerAngle*steer, 0.0 ) * w.originalRotation;
//check if wheel is on ground
if(w.coll.isGrounded)
onGround=true;
var hit : WheelHit;
var c : WheelCollider;
c = w.coll;
if(c.GetGroundHit(hit))
{
//if the wheel touches the ground, adjust graphical wheel position to reflect springs
w.graphic.localPosition.y-=Vector3.Dot(w.graphic.position-hit.point,transform.up)-w.coll.radius;
//create dust on ground if appropiate
if(rigidbody.velocity.x > 5)
{
groundDustEffect.position=hit.point;
groundDustEffect.particleEmitter.worldVelocity=rigidbody.velocity*0.5;
groundDustEffect.particleEmitter.minEmission=1;
groundDustEffect.particleEmitter.maxEmission=1.5;
groundDustEffect.particleEmitter.Emit();
}
}
}
Anyone have any tips&tricks to save some performance here?
Are you measuring performance in the editor? Editor caps and quantizes the frame rate, so it’s a poor indicator for performance. Try seeing what difference it makes in the standalone player.
just jumping in here - are you using the jeep from the vehicles example? that thing is not realtime friendly - way too many materials polys if i recall - i’d definitly use a different vehicle model if that’s the case ; )
Welcome to the underclocked HD2600 XT and its drivers! Unfortunately, multiplicative effects don’t seem to be its strong point. Nor anti-aliasing. Or anything except being DX10-compliant, really. I’m just glad I got the 20" iMac so the card doesn’t have to fill as many pixels.