hi, i have this script to rotate tiles in bge.
import bgefrom math import radians
def main():
cont = bge.logic.getCurrentController()
own = cont.owner
actu = cont.actuators['Motion']
if not "rot" in own:
own["rot"] = 0
scene = bge.logic.getCurrentScene()
target = scene.objects["Cube"]
dist = ( own.getDistanceTo(target))
rot_amount = 0.1
if dist<0.1:
if own["rot"] <180:
own["rot"] += rot_amount
own.applyRotation([0,0,radians(rot_amount)], 1)
else:
if own["rot"] >0:
own["rot"] -= rot_amount
own.applyRotation([0,0,radians(-rot_amount)], 1)
main()
but the problem is the tiles are just rotating from a to b and back again with no sense of weight behind them. i would like it to slowly build up the rot_amount so it starts of slowly and gains more speed as it rotates.
i have tried to add in a rot_amount = rot_amount*2 to get around this problem but then the tiles continuously rotate and do not stop at the 180 point or rotate back for that matter.
any help would be very much appreciated