public override void onCollision(ShapeBase obj, SceneObject col, Point3F vec, float len) { Player player = obj.getId(); if (player.getState() == "Dead") { return; } // Try and pickup all items if (col.getClassName() == "Item") { player.pickup(col.ID, 1); return; } if (col.GetType() != typeof(WheeledVehicle)) { return; } WheeledVehicle vcol = (WheeledVehicle)col; //AI are not allowed to drive they are lousey drivers.... GameConnection client = player["client"]; if (!client.isObject()) { return; } //Mount Vehicle. if ((console.getTypeMask(col) & (UInt32)SceneObjectTypesAsUint.GameBaseObjectType) != (UInt32)SceneObjectTypesAsUint.GameBaseObjectType) { return; } VehicleData db = vcol.getDataBlock(); if ( !(((db.getClassName() == "WheeledVehicleData") || player["mountVehicle"].AsBool() || player.getState() == "Move" || col["mountable"].AsBool()))) { return; } // Only mount drivers for now. // For this specific example, only one person can fit // into a vehicle int mount = vcol.getMountNodeObject(0); if (mount > 0) { try { Player p = mount; return; } catch (Exception err) { //Water particle emitters seem to take up the seat when the vehicle is in water. vcol.unmountObject(mount.AsString()); vcol.mountObject(player, 0, new TransformF()); ((GameConnection)player["client"]).setFirstPerson(false); console.commandToClient(client, "PushVehicleMap"); } } else { vcol.mountObject(player, 0, new TransformF()); ((GameConnection)player["client"]).setFirstPerson(false); console.commandToClient(client, "PushVehicleMap"); } //if (mount > 0) //return; // For this specific FPS Example, always mount the player to node 0 player["mVehicle"] = col; }