Jump to content
XdarionX

Teleport Middle Mouse Button reset camera angles, please help

Recommended Posts

XdarionX

Hello,

Im trying to rewrite code for teleport MMB because everytime i teleport it resets camera rotation. Original code from teleport.lua

---------------------------------------------------------------------------------------------------

if ( not GameSetup ) then
    return
end
local get_ray = get_ray
local pp_config = pp_config
local M_player = managers.player
local warp_to = M_player.warp_to
local rot0 = Rotation(0,0,0)

local function TELEPORT()
    local ray = get_ray( pp_config.TeleportPenetrate )
    if ray then
        warp_to(M_player, ray.hit_position, rot0)
    end
end

return TELEPORT

 

----------------------------------------------------------------------------------------------------------------

So i changed it to:

--------------------------------------------------------------------------------------------------------------------

if ( not GameSetup ) then
    return
end
local get_ray = get_ray
local pp_config = pp_config
local M_player = managers.player
local player = M_player:player_unit()
local camera = player:camera()
local camera_rot = camera:rotation()

local function TELEPORT()
    local ray = get_ray( pp_config.TeleportPenetrate )
    if ray then
        M_player:warp_to( ray.hit_position, Rotation(camera_rot:x(),camera_rot:y(),camera_rot:z()) )
    end
end

return TELEPORT

-------------------------------------------------------------------------------------------------------------------------

but then i cant open in-game menu (all) and cant teleport too + no cross in middle of screen and all my weap skins disappeared

Please someone help, its important for me, thanks

Oh in newer version it is fixed :D

 

Share this post


Link to post
Share on other sites
Delshirex

# 2   Posted (edited)

I do not really know the internals of the trainer nor the api since i haven't even looked at it but one possible fix would be to copy ur actual x/y viewports coords, use the tp that PPR already has (the code ppr uses to tp) and then change the viewport coords to the ones u previously saved.

 

So it would be smth like ==> Press tp button ==> save x/y coords (cam coords) ==> warp_to ==> change camera coords to the ones u saved.

 

BTW: I dunno if modifying the trainer funcs directly is the best way to do it, i would get all the dependencies and run it like a user script probably.

 

EDIT 2: I am testing the PPR TP and its working fine.

Edited by Delshirex

Share this post


Link to post
Share on other sites
Delshirex

Nah, he was probably using an older version of the trainer that reseted the camara rotation on teleport so he wanted to fix it, but in the last version it's already fixed so this thread should lead anywhere by now. At least that's what i understood.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Stop being a peeping tom and join the community.... we got cookies

Join the crew now

Sign in

Already part of the crew? Board right here

Sign In Now

×