TrueAxis physics wrapper Windows/Linux 32/64-bit.

Headers, Bindings, Libraries for use with FreeBASIC, Please include example of use to help ensure they are tested and usable.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

TrueAxis physics wrapper Windows/Linux 32/64-bit.

Post by D.J.Peters »

TrueAxis physics wrapper for FreeBASIC.

download: TrueAxisWrapper.zip from Wed Jun 15, 2016

True Axis FreeBASIC Wrapper documentation first version
download: TrueAxisWrapper.chm
online: TrueAxisWrapper.html

how to start:
extract the zip archive with folder

copy the right lib to the right place

cd TrueAxisWrapper

Linux x86:
sudo cp *x86.so /usr/lib

Linux x86_64:
sudo cp *x86_64.so /usr/lib

password: ****
chmod +x build_all.sh
./build_all.sh

Windows:
copy the 32 or 64-bit dll to X:\windows\system32
execute build_all.bat

Joshy
Last edited by D.J.Peters on Oct 12, 2022 18:08, edited 14 times in total.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: TrueAxis physics wrapper (Win32, Linux x86)

Post by D.J.Peters »

Test7.bas added
First very simple test of class CarTemplate.
youtube: https://www.youtube.com/watch?v=5L0S_7G8z_E

Joshy

Code: Select all

function CreateSimpleCar(carwidth as single=2,carheight as single=1.2,carlength as single=4) as DynamicObjectCar ptr
  ' create a car from CarTemplate
  dim as CarTemplate ptr CarDesc = CarTemplateCreateNew() 
  CarTemplateBeginInitialise(CarDesc) 

  ' add car CollisionObject (a simple box in this case)
  dim as CollisionObjectConvex ptr Convex = CollisionObjectConvexCreateNew()
  CollisionObjectConvexInitialiseAsABox Convex,0,CarHeight/8,0,CarWidth/2,CarHeight/2,CarLength/2
  CarTemplateAddCollisionObjectConvex CarDesc,Convex
  ' we no longer need the collision box here.
  CollisionObjectConvexRelease Convex

  ' add wheels
  
  ' steering front wheels
  const as single fWheelTop    =   0.0
  const as single fWheelBottom =  -1.0
  dim   as single fWheelXPos   =  (CarWidth -fWheelWidth/2)/2
  dim   as single fWheelZPos   =  (CarLength-fWheelSize   )/2

  ' rear wheels
  const as single bWheelTop    =  0.0
  const as single bWheelBottom = -1.0
  dim   as single bWheelXPos   =  (CarWidth -fWheelWidth/2)/2
  dim   as single bWheelZPos   = -(CarLength-fWheelSize   )/2


  'CarTemplateWheelSetSuspensionSpringConstant (40000)
  'CarTemplateWheelSetSuspensionDampingConstant(10000)

  CarTemplateWheelSetRadius(fWheelSize/2) ' radius
  CarTemplateWheelSetSteeringFlag  IS_ON
  CarTemplateWheelSetDrivingFlag   IS_OFF
  CarTemplateWheelSetHandBrakeFlag IS_OFF

  ' Front wheels
  CarTemplateWheelSetSuspensionTop    fWheelXPos,fWheelTop   ,fWheelZPos
  CarTemplateWheelSetSuspensionBottom fWheelXPos,fWheelBottom,fWheelZPos
  CarTemplateAddWheel(CarDesc)    
  
  CarTemplateWheelSetSuspensionTop    -fWheelXPos,fWheelTop,   fWheelZPos
  CarTemplateWheelSetSuspensionBottom -fWheelXPos,fWheelBottom,fWheelZPos
  CarTemplateAddWheel CarDesc

  CarTemplateWheelSetRadius bWheelSize/2
  CarTemplateWheelSetSteeringFlag  IS_OFF
  CarTemplateWheelSetDrivingFlag   IS_ON
  CarTemplateWheelSetHandBrakeFlag IS_ON

  if 1 then   '  6 wheel vehicle
    CarTemplateWheelSetSuspensionTop    bWheelXPos,bWheelTop   ,bWheelZPos+bWheelSize+0.1
    CarTemplateWheelSetSuspensionBottom bWheelXPos,bWheelBottom,bWheelZPos+bWheelSize+0.1
    CarTemplateAddWheel CarDesc
  
    CarTemplateWheelSetSuspensionTop    -bWheelXPos,bWheelTop   ,bWheelZPos+bWheelSize+0.1
    CarTemplateWheelSetSuspensionBottom -bWheelXPos,bWheelBottom,bWheelZPos+bWheelSize+0.1
    CarTemplateAddWheel CarDesc
  end if 
  
  ' Rear wheels
  CarTemplateWheelSetSuspensionTop    bWheelXPos,bWheelTop   ,bWheelZPos
  CarTemplateWheelSetSuspensionBottom bWheelXPos,bWheelBottom,bWheelZPos
  CarTemplateAddWheel CarDesc
  
  CarTemplateWheelSetSuspensionTop    -bWheelXPos,bWheelTop   ,bWheelZPos
  CarTemplateWheelSetSuspensionBottom -bWheelXPos,bWheelBottom,bWheelZPos
  CarTemplateAddWheel CarDesc
    
  
  CarTemplateSetMass CarDesc,carwidth*carheight*carlength*100
  CarTemplateSetTorqueMultiplier CarDesc,2.0
  CarTemplateSetDownForce CarDesc,4.0
  
  CarTemplateEndInitialise CarDesc

  ' create a DynamicObjectCar from our CarTemplate
  dim as DynamicObjectCar ptr NewCar = DynamicObjectCarCreateNew()
  DynamicObjectCarInitialise NewCar,CarDesc
  ' we no longer need the CarTemplate here.
  CarTemplateRelease CarDesc
  ' add the car to the physics simulation
  PhysicsAddDynamicObject NewCar
  return NewCar
end function
Last edited by D.J.Peters on Oct 12, 2022 18:09, edited 2 times in total.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: TrueAxis physics wrapper (Win32, Linux x86)

Post by D.J.Peters »

New version published.

added:
SurfaceAttributeSetUserData
SurfaceAttributeGetUserData

changed:
all class Realese mehods set the class pointer to NULL (byref)

Joshy
Last edited by D.J.Peters on Mar 11, 2015 5:21, edited 1 time in total.
badidea
Posts: 2586
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: TrueAxis physics wrapper (Win32, Linux x86)

Post by badidea »

"340 sub's and functions"

A lot of work, nice!

Can you crash 2 cars? Maybe under a small angle to make the result more interesting?

Or a train crash with wagons loaded with wood :-)
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: TrueAxis physics wrapper (Win32, Linux x86)

Post by D.J.Peters »

short video: 500 cars
Last edited by D.J.Peters on Oct 12, 2022 18:09, edited 2 times in total.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: TrueAxis physics wrapper (Win32, Linux x86)

Post by D.J.Peters »

badidea wrote:A lot of work
You are right it's more as an simple wrapper I modified the car class and added more stability.

Joshy
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: TrueAxis physics wrapper (Win32, Linux x86)

Post by D.J.Peters »

Cars in a sandbox :-)

Joshy
Last edited by D.J.Peters on Oct 12, 2022 18:09, edited 2 times in total.
badidea
Posts: 2586
Joined: May 24, 2007 22:10
Location: The Netherlands

Re: TrueAxis physics wrapper (Win32, Linux x86)

Post by badidea »

Dakar Rally!
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: TrueAxis physics wrapper (Win32, Linux x86)

Post by D.J.Peters »

sandbox 2

Joshy
Last edited by D.J.Peters on Oct 12, 2022 18:09, edited 2 times in total.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: TrueAxis physics wrapper (Win32, Linux x86)

Post by D.J.Peters »

Last edited by D.J.Peters on Jul 19, 2014 14:12, edited 1 time in total.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: TrueAxis physics wrapper (Win32, Linux x86)

Post by D.J.Peters »

Last edited by D.J.Peters on Jul 20, 2014 7:35, edited 1 time in total.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: TrueAxis physics wrapper (Win32, Linux x86)

Post by D.J.Peters »

Last edited by D.J.Peters on Oct 12, 2022 18:10, edited 2 times in total.
angros47
Posts: 2321
Joined: Jun 21, 2005 19:04

Re: TrueAxis physics wrapper (Win32, Linux x86)

Post by angros47 »

Nice!

Are you using your own routines to load cars, and to build the terrain, or some 3d engine?

To use it in linux, you don't need to be superuser and copy the library in usr/lib, you could do:

cd TrueAxisWrapper
fbc Test01.bas
LD_LIBRARY_PATH=./:$LD_LIBRARY_PATH ./Test01
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: TrueAxis physics wrapper (Win32, Linux x86)

Post by D.J.Peters »

You can download the lates version with round about 670 functions.

Joshy
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: TrueAxis physics wrapper (Win32, Linux x86)

Post by D.J.Peters »

Curently I build and test TrueAxis for FreeBasic Windows 64 bit, Linux_x86_64, ARM6 and ARM7.

Joshy

FreeBasic & TrueAxis (OpenGL) on raspberry pi arm cpu..
Image
Last edited by D.J.Peters on Oct 12, 2022 18:10, edited 3 times in total.
Post Reply