# Smooth Movement

I'm making a game where, when a certain even occurs, I want the camera to move up slowly. When triggered, I have the following Python Script for it:

import bge
cont = bge.logic.getCurrentController()
own = cont.owner
if cont.sensors['Hit Cube'].positive:
start = own.worldPosition.z
while own.worldPosition.z-start<2:
own.worldPosition.z +=.1


This works for moving the camera up 2 blender units, but it does not smooth the motion at all. What are some suggestions to accomplish this effect?

• try own.applyMovement() or applyForce also there is damping property – Chebhou May 1 '15 at 21:02
• Can you tell me how I would do that? Thanks! – Anson Savage May 2 '15 at 23:59

You could use a function like z=dist*0.5*(1-cos((now-t0)/duration*pi)) which would start out slow, speed up, and then slow to a stop after duration seconds.
In your exaple, where you move the camera upwards the z-axis, it could happen with something like this: own.worldLinearVelocity.z = own.worldLinearVelocity.z+1 But again check that post, cause I hear it is better to play with forces.