Esempio n. 1
0
        // Standard and Static callback create methods for the asset manager
        private Gobject CreateRover()
        {
            RoverObject r = null;
            try
            {
                Vector3 pos = Vector3.Zero;
                float maxSteerAngle = 30.0f;
                float steerRate = 5.0f;
                float wheelSideFriction = 4.7f;
                float wheelFwdFriction = 5.0f;
                float wheelTravel = 0.2f;
                float wheelRadius = 0.4f;
                float wheelZOffset = 0.05f;
                float wheelRestingFrac = 0.45f;
                float wheeldampingFrac = 0.3f;
                int wheelNumRays = 1;
                float driveTorque = 200.0f;

                r = new RoverObject(0, pos, roverModel, wheelModel, roverRadar, cubeModel, RotArm, roverCam, Pole, maxSteerAngle, steerRate,
                    wheelSideFriction, wheelFwdFriction, wheelTravel, wheelRadius, wheelZOffset, wheelRestingFrac, wheeldampingFrac, wheelNumRays,
                    driveTorque, /*physicsManager.PhysicsSystem.Gravity.Length());*/ 10f);
                // TODO FIX - Jeffrey changed gravity to magic constant because planets have their own gravity ... thus PhysicsSystem.Gravity = 0;
                r.Rover.EnableCar();
                r.Rover.Chassis.Body.AllowFreezing = false;

                if (isServer)
                    r.AddCollisionCallback(CollisionSkin_callbackFn);
            }
            catch (Exception E)
            {
                System.Diagnostics.Debug.WriteLine(E.StackTrace);
            }
            return r;
        }
Esempio n. 2
0
 private Gobject SpawnRover(int ownerid, int objectid)
 {
     Gobject newobject = GetRover(new Vector3(90, 20, 20));
     newobject.ID = objectid;
     physicsManager.AddNewObject(newobject);
     Debug.WriteLine("Selecting: owner" + ownerid + " mine" + MyClientID);
     if (ownerid == MyClientID) // Only select the new car if its OUR new car
     {
         myRover = (RoverObject)newobject;
         SelectGameObject(myRover);
     }
     return newobject;
 }
Esempio n. 3
0
 /// <summary>
 /// CLIENT SIDE
 /// client should do something oriented to the specific game here, like player bullets or cars.
 /// The server has granted the object request and this is where the client handle the response the server has sent back 
 /// This is called from the Network code, thus in the Network threads
 /// </summary>
 /// <param name="objectid"></param>
 /// <param name="asset"></param>
 public override void ProcessObjectAdded(int ownerid, int objectid, int asset)
 {
     Debug.WriteLine("Process Object Added: owner:" + ownerid + " id:" + objectid + " asset:" + asset);
     Gobject newobject = assetManager.GetNewInstance((AssetTypes)asset);
     newobject.ID = objectid;
     physicsManager.AddNewObject(newobject);
     if (ownerid == MyClientID) // Only select the new car if its OUR new car
     {
         if (newobject is RoverObject)
         {
             myRover = (RoverObject)newobject;
             SelectGameObject(myRover);
         }
     }
 }