Jump to content
Korean Random
copyisrighted

Auto aim target shotpoint correction

Recommended Posts

Hi,

Thanks to the WOT-Decompiled source, I can write the mod much easier. What I want to do is to add manual correction to auto-aimed target shoot.

I found predictLockedTargetShotPoint from VehicleGunRotator and hooked as this new function to include the speed and manual correction.

I can see that the marker is already changed in game. 

 

However, my question is why the actual shot point is still the original autoAimVehicle.position ? Is this auto aimed target shot point calculated and locked at the server side?

def predictLockedTargetShotPoint(self, *args, **kargs):
        """ return False will prevent old func from running
            global UP in map is positive Z
            global RIGHT in map is positive X
            local front is positive Z
            local right is positive X
            rotate left
        """
        with suppressButLog(Exception):
            autoAimVehicle = BigWorld.player().autoAimVehicle
            
            if autoAimVehicle is not None:
                player = BigWorld.player()
                vname = autoAimVehicle.typeDescriptor.type.name
                
                centerBias = self.shotOffset.get(vname, Math.Vector3(0,0,0))

                autoAimPosition = Math.Vector3(autoAimVehicle.position)
                dist = (autoAimPosition - player.getOwnVehiclePosition()).length
                shotspeed = player.vehicle.typeDescriptor.shot.speed
                aimVspeed, aimVrot = autoAimVehicle._Vehicle__speedInfo.value[:2]
                velVec = Math.Vector3(aimVspeed*math.sin(aimVrot),0,aimVspeed*math.cos(aimVrot))*self.speedGain*dist/shotspeed/100.0
                offset = getLocalAimPoint(autoAimVehicle.typeDescriptor)
                worldoff = Math.Matrix(autoAimVehicle.matrix).applyVector(offset+velVec+centerBias)                    
                autoAimPosition += worldoff
                return False, args, kargs, autoAimPosition
            else:
                return False, args, kargs, None
        return True, args, kargs, None

 

Share this post


Link to post

Short link
Share on other sites
12 часов назад, copyisrighted сказал:

However, my question is why the actual shot point is still the original autoAimVehicle.position ?

 

LOL

    def autoAim(self, target=None, magnetic=False):
        if target is None:
            vehID = 0
        elif not isinstance(target, Vehicle.Vehicle):
            vehID = 0
        elif target.id == self.__autoAimVehID:
            vehID = 0
        elif target.publicInfo['team'] == self.team:
            vehID = 0
        elif not target.isAlive():
            vehID = 0
        else:
            vehID = target.id
        if self.__autoAimVehID != vehID:
            self.__autoAimVehID = vehID
            self.cell.autoAim(vehID, magnetic)   <================================================================= Server AutoAim
            if vehID != 0:
                self.inputHandler.setAimingMode(True, AIMING_MODE.TARGET_LOCK)
                self.gunRotator.clientMode = False
                self.onLockTarget(AimSound.TARGET_LOCKED, True)
                TriggersManager.g_manager.activateTrigger(TRIGGER_TYPE.AUTO_AIM_AT_VEHICLE, vehicleId=vehID)
            else:
                self.inputHandler.setAimingMode(False, AIMING_MODE.TARGET_LOCK)
                self.gunRotator.clientMode = True
                self.__aimingInfo[0] = BigWorld.time()
                minShotDisp = self.vehicleTypeDescriptor.gun.shotDispersionAngle
                self.__aimingInfo[1] = self.gunRotator.dispersionAngle / minShotDisp
                self.onLockTarget(AimSound.TARGET_UNLOCKED, True)
                TriggersManager.g_manager.deactivateTrigger(TRIGGER_TYPE.AUTO_AIM_AT_VEHICLE)
                gui_event_dispatcher.hideAutoAimMarker()
        return

 

Share this post


Link to post

Short link
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...