private void Parse(string filename) { string carFile = Path.Combine(GameConfig.CdDataPath, filename); BinaryReader br = new BinaryReader(File.Open(carFile, FileMode.Open)); HeaderChunk rootChunk = new HeaderChunk(); rootChunk.Read(br, true); // Cfm files contain a high-res model + bitmaps at index 0, and a low-res model + bitmaps at index 1. We only use the high-res resources. rootChunk.MeshChunks[0].Load(br); rootChunk.BitmapChunks[0].TextureGenerated += CfmFile_TextureGenerated; rootChunk.BitmapChunks[0].Load(br); br.Close(); Mesh = new CarMesh(rootChunk.MeshChunks[0], rootChunk.BitmapChunks[0], _brakeColor); }
public override void _PhysicsProcess(float delta) { ComputeBoosting(delta); ComputeDirection(); ComputeVelocity(); ComputeGravity(); Velocity = MoveAndSlide(Velocity, Transform.basis.y); var direction = new Vector3( Velocity.x, Velocity.y, Mathf.Abs(Velocity.z) ); CarMesh.LookAt(GlobalTransform.origin + (direction - Vector3.Forward), Transform.basis.y); AlignCarWithGround(); }