adding the feel of weight to movement

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

You could animate the rotation by hand so you can add the ease-in/out that you are looking for then play the correct animation when you want them to rotate.

i tried using an animation for the rotations and added a near sensor so it would rotate when it came close to a ‘cube’ acting as a character, but i was unable to figure out how to play the animation in reverse/mirrored. there was also the idea of having say frame 1 to 150 as the tile going one way and frame 151 to 300 as the tile going back but again i am unsure of how to play the different parts of the animation. am also not the good with scripting to be able to figure this out

Hey there. It sounds like you could either play the animation as a flipper (it reverses the animation on the negative pulse, when your character is not near the tile). Or make two animations like you said, but you would need two action actuators, one that plays from 1-150 when near, and one from 151-300 when not near. I think you’d want to force the animation to be local also…
I’m not a pro, but hope it helps :slight_smile: