Пример #1
0
        public VehicleDynamics(PhysxPrim physxPrim, VehicleProperties shadowProps, PhysX.Physics physics, PhysxScene scene)
        {
            _angularstatsX = new RunningStat();
            _angularstatsY = new RunningStat();
            _angularstatsZ = new RunningStat();
            _linearstatsX  = new RunningStat();
            _linearstatsY  = new RunningStat();
            _linearstatsZ  = new RunningStat();

            _actor = physxPrim;
            _props = new VehicleProperties();
            _physics = physics;
            _scene = scene;
            _motor = new VehicleMotor(ref _actor, ref _props, ref _physics, ref _scene);

            // Preset the defaults and new common keys. This ensures scripts with older versions of saved state
            // do not crash the simulator since the new keys do not exist in the old state.
            _props.Type = VehicleType.None;
            SetVehicleDefaults(_props);

            // Merge the new properties.
            _props.Merge(shadowProps);
            SetVehicleDefaultActions();

            if (VehicleLimits.DebugVehicleChange) m_log.InfoFormat("[VehicleDynamics] constructed type={0} name={1} at {2}", _props.Type, _actor.SOPName, _actor.Position);
            //DisplayParameters();
        }