GM raycast vehicle not working tried 1000 times.

ean
Posts: 1
Joined: Thu Jan 26, 2012 6:44 pm

GM raycast vehicle not working tried 1000 times.

Post by ean »

In the GM port (I know I know...the guy hasn't posted on the forums in a year and there are no tutorials whatsoever) of Bullet, I am trying to do Raycast Vehicle. So far absolutely nothing works, the closest I've came is having the 2nd and third wheels moving for no reason, zero engine and rigid body response to the wheels, and the first wheel being locked at position 50,0, and the 4th wheel being locked at position -2,-2. I even set the attachx paramater to random(360) and the first wheel is still locked to position 50,0.

Could someone give me an overview of how to use Raycast Vehicle? Is his DLL bugged or am I doing it wrong?

Here are some vital links:

Link to the original GMC topic, where the GM port of Bullet is:

http://gmc.yoyogames.com/index.php?showtopic=379653

http://www.andrewpaul.com/GMBullet.zip

Excerpt from Andrew Paul's manual:

Raycast Vehicle


The following are functions which deal with Vehicle constraints. The vehicle constraint can be an easy way to make a vehicle, with the rigidbody being the chassis. The wheels are approximated by raycasts. It works better for faster vehicles than slow ones.


GMBULLET_SetCurrentTuning(frictionSlip,maxSuspensionTravel,
suspensionCompression,suspensionDamping,suspensionStiffness)
This sets the current tuning parameters used when creating vehicles and wheels.


GMBULLET_CreateVehicle(ID1,rightAxis,upAxis,forwardAxis)
Creates a vehicle constraint, using the rigid body specified by ID1 as the chassis. rightAxis, upAxis, and forwardAxis specifies which axis the vehicle should be based around. Use 0 for x, 1 for y, and 2 for z.
You should also use SetCurrentTuning before calling this function.
Returns a constraint ID on success.


GMBULLET_SetUpWheel(dirx,diry,dirz,axelx,axely,axelz)
Prepares some additional properties for a wheel, dirx,diry,dirz specify a direction vector allong which the wheel faces (and hence pushes the car towards,) while axelx,axely,axelz specifies the vector allong which the wheel's axel lies.


GMBULLET_AddWheel(ID,attachx,attachy,attachz,suspensionRestLength,
radius,isfront)
Creates a wheel for the vehicle constraint specified by ID. attachx,attachy,attachz specifies the location to attach the wheel. radius is the radius of the wheel, isfront specifies whether the wheel is a front one or not (not sure how this effects it exactly,) and I'm not sure what suspensionRestLength does either.
Both SetUpWheel and SetCurrentTuning effect the creation of the wheel.
Returns the wheel index on success. Wheel Id's are powers of 2, with 1 being the first wheel returned, 2 being the second, 4 being the third, etc... you may have a maximum of 32 wheels.


GMBULLET_ApplyEngineForce(ID,wheelindex,force)
Applies an engine force to the wheel wheelindex of vehicle ID.
Because wheel indices are powers of two, you may bitwise OR (or add) multiple indices together to apply engine force to multiple wheels.
This may be done with the other functions which take wheelindex as an argument


GMBULLET_SetBrake(ID,wheelindex,brake)
Applies a braking force brake to the wheel wheelindex of vehicle ID


GMBULLET_SetSteering(ID,wheelindex,steering)
Applies a steering angle of steering to the wheel wheelindex of vehicle ID


GMBULLET_ChangeWheelProperties(ID,wheelindex,attachx,attachy,attachz,
suspensionRestLength,radius,isfront)
Changes the properties of the wheel wheelindex of vehicle ID.


GMBULLET_GetCurrentSpeed(ID)
Returns the current speed of the vehicle ID, in kilometers per hour.


Some code I have used ("//" are comments):

Code: Select all

[size=85]//Set the Z
z = 5;

// GMBULLET_AddRigidBody(mass,type,shapeID,x,y,z,rx,ry,rz)
body = GMBULLET_AddRigidBody( 1, 1,  PhysX_control.shape_box, x,y,z, 90,0,0);

GMBULLET_SetCurrentTuning(10,.1,2.82,4.24,50)

carscale=5
//y is z z is x x is y
//car=GMBULLET_CreateVehicle(body,2,0,1)
car=GMBULLET_CreateVehicle(body,2,0,1)
global.debug1=0

//GMBULLET_SetUpWheel(0,0,-1,0,-1,0)
//GMBULLET_SetUpWheel(-1,0,0,0,0,-1)
//wheel1=GMBULLET_AddWheel(car,-8,1,-3,0.15*carscale,.35*carscale,0)

GMBULLET_SetUpWheel(random(360),random(360),random(360),random(360),random(360),random(360))
wheel1=GMBULLET_AddWheel(car,x-3,y-8,z+1,0.15*carscale,.35*carscale,1)
//GMBULLET_SetUpWheel(-1,0,0,0,0,1)
//wheel2=GMBULLET_AddWheel(car,-8,1,3,0.15*carscale,.35*carscale,0)

GMBULLET_SetUpWheel(random(360),random(360),random(360),random(360),random(360),random(360))
wheel2=GMBULLET_AddWheel(car,x+3,y-8,z+1,0.15*carscale,.35*carscale,1)
//GMBULLET_SetUpWheel(-1,0,0,0,0,-1)
GMBULLET_SetUpWheel(random(360),random(360),random(360),random(360),random(360),random(360))
wheel3=GMBULLET_AddWheel(car,x-3,y,z+1,0.15*carscale,.35*carscale,0)
//wheel3=GMBULLET_AddWheel(car,0,1,-3,0.15*carscale,.35*carscale,0)

GMBULLET_SetUpWheel(random(360),random(360),random(360),random(360),random(360),random(360))
wheel4=GMBULLET_AddWheel(car,x+3,y,z+1,0.15*carscale,.35*carscale,0)

GMBULLET_ChangeWheelProperties(wheel1,random(360),random(360),random(360),
      0,2,1)[/size]
User avatar
tireboy
Posts: 3
Joined: Tue Mar 20, 2012 7:45 am

Re: GM raycast vehicle not working tried 1000 times.

Post by tireboy »

Could someone give me an overview of how to use Raycast Vehicle? Is his DLL bugged or am I doing it wrong?

Here are some vital links:

Link to the original GMC topic, where the GM port of Bullet is:

http://gmc.yoyogames.com/index.php?showtopic=379653

http://www.andrewpaul.com/GMC Parts
Excerpt from Andrew Paul's manual:

Raycast Vehicle
hi sir I've read your problem, thinking for several hours I just can't make it. have you done with this? hmmm