def alignAxisToPosition(self,target,spd): dis = math.distanceBetweenPoints(data.position,target) xradians = math.lawofCosignsRadians(dis,dis,math.distanceBetweenPoints(math.rotateAroundVector(self.position,self.orientation,dis,0),target)) yradians = math.lawofCosignsRadians(dis,dis,math.distanceBetweenPoints(math.rotateAroundVector(self.position,self.orientation,dis,1),target)) amount = xradians / spd * (1.5707963267948966 - yradians) / math.absoluteValue(1.5707963267948966 - yradians) globalRotation(data,amount,0,0)
def coneRadarBoolean(pos,ori,obj,alimit,dlimit,axis): adis = math.distanceBetweenVectors(pos,obj) ref = math.rotateAroundVector(pos,ori,adis,axis) cdis = math.distanceBetweenVectors(ref,obj) angle = math.lawOfCosigns(adis,adis,cdis) print(Math.toDegrees(angle)) if adis <= dlimit: if alimit >= angle: return True else: return False
def offsetOnAxis(self,obj,axis,offset): self.position = math.rotateAroundVector(obj.position,obj.orientation,offset,axis)