Hi VIP3R,
OK Ive spent some time messing with Fdir and have come to a dead end.
The following code is the segment of my program (from inside the main loop just before 'updategeoms') which calculates the direction of each wheel and applies the geom parameters to define Fdir1.
(Ive used the common variables from any of the JV-ODE car demos).
Problem is it doesnt seem to work. Try setting mu2 to a silly low value (i.e. no sideways grip) and see what happens. Its like the Fdir1 direction is not being set each loop.
I think I understand the principle of what i need to do - its just how I achieve it in the code thats stumping me.
Hopefully I'm missing something really simple (not for the first time!)
Let me know what you think friend - as always - really appreciate your time.
cheers,
Mark
OK Ive spent some time messing with Fdir and have come to a dead end.
The following code is the segment of my program (from inside the main loop just before 'updategeoms') which calculates the direction of each wheel and applies the geom parameters to define Fdir1.
(Ive used the common variables from any of the JV-ODE car demos).
; loop through all four wheels of car For count=1 To 4 ; use the direction of the car body to create a vector (to set friction direction) ; get angle of car body car_angle#=dGeomGetYaw(CGeom) ; factor in the angle between the wheel and the car body so the steering wheels are catered for wheel_angle#=dJointGetHinge2Angle1(joint(count))*57.4 ; (57.4 = radians to degrees) x_component#=Sin(car_angle#+wheel_angle#)*-1.0 y_component#=0.0 z_component#=Sin(car_angle#+wheel_angle#+90.0) ; set geoms contact parameters dGeomContactSetMode(WGeom(count),dContactFDir1+dContactSlip1) ; friction in direction wheel is rolling dGeomContactSetMu(WGeom(count),20.0) ; friction in perpendicular direction to roll dGeomContactSetMu2(WGeom(count),30.0) ; set friction direction ; Note (!) putting parameters in order i.e. x,y,z gives very strange result - trial and error shows y,x,z as better but not perfect (?) dGeomContactSetFDir1(WGeom(count),y_component#,x_component#,z_component#) ; slip value for direction of roll dGeomContactSetSlip1(WGeom(count),0.005) ; get rotational speed of wheel spin#=dJointGetHinge2Angle2Rate(joint(count)) ; slip value for second direction (factored by rotational speed i.e. k*v) dGeomContactSetSlip2(WGeom(count),0.005+(Abs(spin#)/100)) Next
Problem is it doesnt seem to work. Try setting mu2 to a silly low value (i.e. no sideways grip) and see what happens. Its like the Fdir1 direction is not being set each loop.
I think I understand the principle of what i need to do - its just how I achieve it in the code thats stumping me.
Hopefully I'm missing something really simple (not for the first time!)
Let me know what you think friend - as always - really appreciate your time.
cheers,
Mark