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

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


×