39

« **on:** July 04, 2014, 06:04:14 AM »
hey all.

so im making 2d driving game. anyways long story short, im using hinge joint, and setting motor speed for driving forward and backward. right now it is at 1000 for accelerating, so that means, 1000 degrees of rotation per second.

1 full rotation is 360 degrees, so it means that in one second, wheel does almost 3 full rotations.

but then when player lets go of throttle, i return to idle state, where i just disable "use motor" on hinge joint.

so now comes the tricky part. i need to know at which degrees per second does the wheel turn at. because when player hits throttle again or reverse, wheel rotation needs to start at that value, or else it looks non-natural.

i was fiddling with it for 2 hours now, and couldnt really produce any satisfactory results...

this is what i have now... im using get rotation, and float compare, and then resetting it each second... but i wonder if there is more elegant way of doing this...

my way is not precise way... it doesnt show the same degrees/second as it should be... its always off by 1 rotation, either 1 more, or one less. i need like a really precise method, that will show exact degrees/second

the faster the wheel turns, the more not accurate my method is... so i think i need new approach.