I created a cog that makes wheels roll at the correct speed for how fast they travel, but there is some problem with the wheels not being visible at certain angles.
For some reason, when mainwheelangle is between 90-270, the wheel thing just disappears.
.
Any help will be greatly appreciated.
For some reason, when mainwheelangle is between 90-270, the wheel thing just disappears.
.
Code:
// wheel roll stuff
timerdistance = VectorDist(oldpos, GetThingPos(carwheel)); // from the last pulse, find how out how far the wheel has moved
wheelangle = ((3.929752*timerdistance)*360); // the 3.929752 number is 1/wheelcircumference
oldposfr = GetThingPos(carwheel); // update the old position for the next pulse
mainwheelangle = mainwheelangle + wheelangle; // add the new wheel angle difference to the current angle
while(mainwheelangle > 360)
{
mainwheelangle = mainwheelangle - 360; // keep angles within 360
}
// create a dummy thing to position the wheel to
dummy = FireProjectile(carwheel, projectile, -1, -1, '0 0 0', VectorSet(mainwheelangle, 0, 0), 1.0, 0x20, -1, -1);
TeleportThing(carwheel, dummy); // put the wheel there
DestroyThing(dummy); // remove the dummy thing
PrintFlex(mainwheelangle);Any help will be greatly appreciated.
