Propellor Script Trouble

Lately I have been trying to write a script that will cause an object to accellerate to a certain value. During this acceleration if the dRot value passes a set number ( in this case 2 ) I want the rotating mesh to be replaced by another rotating mesh ( in this case a blurry alpha image of the previously rotating propellor ). So far I have this script, but alas it does not work:

import GameLogic as g
cont = g.getCurrentController()
act = cont.getActuator('act')
def engagefan(speed):
	slowfan = g.getCurrentScene().objects['OBSlowBlades']
	fastfan = g.getCurrentScene().objectsInactive['OBFastBlades']
	r = act.dRot
	if cont.owner != fastfan:
		if r[2] < speed:
			rspeed = r[2]+.001
		elif r[2] > speed:
			rspeed = r[2]-.001
		act.dRot = [r[0],r[1],rspeed]
		if rspeed >= 2:
			g.getCurrentScene.addObject(fastfan,cont.owner,0)
			cont.owner.endObject()
	else:
		if r[2] < speed:
			rspeed = r[2]+.001
		elif r[2] > speed:
			rspeed = r[2]-.001
		if rspeed < 2:
			g.getCurrentScene.addObject(slowfan,cont.owner,0)
			cont.owner.endObject()
##################################################################
engagefan(3)

I don’t think my computer likes the function for some reason. If anyone could tell me what is wrong with it, it would be greatly appreciated! Thank you

You said that you wanted to replace the mesh?

Use

cont.owner.replaceMesh(Mesh_name)

to replace the mesh.

Here is a script:


import GameLogic
cont = GameLogic.getCurrentController()
own = cont.owner

# get the actuator
act = cont.actuators["act"]

speed = 0.5

if act.dRot > speed:    # make sure you are actually changing the dRot
    own.replaceMesh("WhatEverYourMeshNameIs")

Thats just an example. Read it, and if you want, you can turn it into a function or whatever.

Just ask if you need anything.
-Sunjay03