public Vehicle(Actor actor, PhysicMaterial carMaterial = null, VehicleMotor motor = null, VehicleGears gears = null) { if (actor == null) { throw new ArgumentNullException("actor"); } _transmissionEfficiency = 1.0f; _differentialRatio = 1.0f; _maxVelocity = 80; _bodyActor = actor; _scene = actor.Scene; _carMaterial = carMaterial; _bodyActor.SleepEnergyThreshold = 0.05f; _vehicleMotor = motor; _vehicleGears = gears; if (carMaterial == null) { PhysicMaterialDesc matDesc = new PhysicMaterialDesc(); matDesc.DynamicFriction = 0.4f; matDesc.StaticFriction = 0.4f; matDesc.Restitution = 0; _carMaterial = actor.Scene.CreateMaterial(matDesc); _carMaterial.FrictionCombineMode = CombineMode.MULTIPLY; } foreach (var shape in actor.Shapes) { if (shape.Material.Index == 0) { shape.Material = _carMaterial; } if (shape is WheelShape) { RayCastWheel wheel = new RayCastWheel((WheelShape)shape); _wheels.Add(wheel); } } _bodyActor.UserData = this; _motorForce = 0; SetDefaulValues(); Control(0, true, 0, true, false); }
protected internal void RemoveMaterial(PhysicMaterial mat) { materials.items.Remove(mat); }
protected internal void AddMaterial(PhysicMaterial mat) { materials.items.Add(mat); }