JernejL
27-10-2006, 03:51 PM
I am really getting desparate getting new car physics for use with TDC (http://www.pascalgamedevelopment.com/forums/viewtopic.php?t=975&start=165) to work, i can't possibly find the problem, which makes the vehicle dance instead standing stable. The goal of this is, to find the bug, fix the code, and help me get the project back on track, i have here a MSVC project, which can be compiled with MSVC + Newton SDK, and Delphi 7 project (uses glscene).
The original code Was written by sergey / cyko74 from newton physics engine forum. The RCV is acronym for RayCast Vehicle, the most common way of eficiently simulating a vehicle (used by practically every car game out there), each tire is a ray, raycasted onto terrain with suspension, and simulated with great stability and widely adjustable realism, it also features a simulated differential, gearbox and a drivetrain.
The facts: delphi version does not work as expected, the car dances due to unknown misterious forces.
To get the program to run, edit glscene utils3ds.pas with this quich hack to allow loading 3ds files from Zmodeler properly:
// uncomment this line:
// if MatEntry.Tag <> MAT_ENTRY then ShowError(Error3DS_INVALID_CHUNK);
// and this line here:
MAT_DECAL:
; // don't know what do to with it
else
// ShowError(Error3DS_INVALID_CHUNK)
Source Code:
MSVC:
http://www.gtatools.com/TDC/Development/rcvcode/tdcrcv.rar
http://www.gtatools.com/TDC/Development/rcvcode/rcv%20project.rar (Newer version, more stable simulation, i can't even translate older properly)
Delphi 7:
http://www.gtatools.com/TDC/Development/rcvcode/delphircv.rar
There is also a working Delphi 7 demo that uses a much older version of RCV dll, i can't get newer dll's to work with delphi, due to weird MSVC memory alingment in records, but it is doable.
This is here just to show how stable the simulation is, under proper circumstances :)
http://www.gtatools.com/TDC/Development/rcvcode/delphi_with_dll.rar
The main code is in tdcvehicle.cpp, delphi pas file is TDC_RCV.pas.
The source code is free to use for everybody and has no restrictions placed on it, so feel free to use it in other games (if you can fix it ;))
beware, the whole translated code looks rather ugly, since i did extensive re-testing and cutting/pasting code trying to fix the bug, a single run thru jedi code formatter should clean it up a bit, and i intend to re-format, improve, optimize and cleanup the code when it works.
If you can help me get the code to work, i am sure we can work out some kind of fair compensation :)
The original code Was written by sergey / cyko74 from newton physics engine forum. The RCV is acronym for RayCast Vehicle, the most common way of eficiently simulating a vehicle (used by practically every car game out there), each tire is a ray, raycasted onto terrain with suspension, and simulated with great stability and widely adjustable realism, it also features a simulated differential, gearbox and a drivetrain.
The facts: delphi version does not work as expected, the car dances due to unknown misterious forces.
To get the program to run, edit glscene utils3ds.pas with this quich hack to allow loading 3ds files from Zmodeler properly:
// uncomment this line:
// if MatEntry.Tag <> MAT_ENTRY then ShowError(Error3DS_INVALID_CHUNK);
// and this line here:
MAT_DECAL:
; // don't know what do to with it
else
// ShowError(Error3DS_INVALID_CHUNK)
Source Code:
MSVC:
http://www.gtatools.com/TDC/Development/rcvcode/tdcrcv.rar
http://www.gtatools.com/TDC/Development/rcvcode/rcv%20project.rar (Newer version, more stable simulation, i can't even translate older properly)
Delphi 7:
http://www.gtatools.com/TDC/Development/rcvcode/delphircv.rar
There is also a working Delphi 7 demo that uses a much older version of RCV dll, i can't get newer dll's to work with delphi, due to weird MSVC memory alingment in records, but it is doable.
This is here just to show how stable the simulation is, under proper circumstances :)
http://www.gtatools.com/TDC/Development/rcvcode/delphi_with_dll.rar
The main code is in tdcvehicle.cpp, delphi pas file is TDC_RCV.pas.
The source code is free to use for everybody and has no restrictions placed on it, so feel free to use it in other games (if you can fix it ;))
beware, the whole translated code looks rather ugly, since i did extensive re-testing and cutting/pasting code trying to fix the bug, a single run thru jedi code formatter should clean it up a bit, and i intend to re-format, improve, optimize and cleanup the code when it works.
If you can help me get the code to work, i am sure we can work out some kind of fair compensation :)