Hey guys. Im writing a script using the 2.49 api and I need a little help if you would…
An Always sensor triggers constant motion along the Y-axis, and a Ray sensor triggers this script :
#=========================================== # Uses ray to detect collisons with objects #=========================================== # Setup : g = GameLogic cont = g.getCurrentController() # Get Sensor : ray = cont.sensors["sensDetect"] # Sensor that detects collisions. # Get Actuator : actTrack = cont.actuators["actTrack"] # Actuator that handles object tracking. # Vars : rHit = ray.hitObject rDist = ray.range rAx = ray.axis trackTo = actTrack.object rAx = 0 rDist = 5.0 if ray.positive: print "Just hit: " print rHit if rHit == "wp1": trackTo = "wp2" print "Going to: " print trackTo
I’m know my syntax is wrong when it comes to the last bit here, and I’ve tried a few different things to get it working without success. I’m not sure if this is the best approach either, so any advice from those experienced would be helpful.