Very crude, how to improve it?
So I figured I'd finally give a try to get a rotation view for the skulk, as I feel it greatly enhances your wallwalking abilities. I found what I thought I wanted in Skulk_Client.lua. Sure enough, I got the view to rotate, but it is very crude. Mainly because I haven't changed the movement vectors, and it seems like they aren't tied to camera rotation. What this means, is that when you are standing on a wall, left-right mouse movements becomes up-down, and up-down becomes left-right. W and S works like normally, but A and D give strange results. The view also changes orientation at certain angles, rotation your view almost a full circle while you just looked slightly in one direction. It's really hard to explain, it is right now pretty much unplayable. Anyone here who knows how to to fix it/who have already done it? A quick search didn't give me anything.
CODE
// ======= Copyright © 2003-2011, Unknown Worlds Entertainment, Inc. All rights reserved. =======
//
// lua\Skulk_Client.lua
//
// Created by: Brian Cronin (brianc@unknownworlds.com)
//
// ========= For more information, visit us at http://www.unknownworlds.com =====================
Skulk.kCameraRollSpeedModifier = 1
Skulk.kCameraRollTiltModifier = 1
function Skulk:UpdateMisc(input)
Alien.UpdateMisc(self, input)
if self.currentCameraRoll == nil then
self.currentCameraRoll = 0
end
if self.goalCameraRoll == nil then
self.goalCameraRoll = 0
end
self.currentCameraRoll = LerpGeneric(self.currentCameraRoll, self.goalCameraRoll, math.min(1, input.time *
Skulk.kCameraRollSpeedModifier))
end
local gEnableTilt = true
// Tilt the camera based on the wall the Skulk is attached to.
function Skulk:PlayerCameraCoordsAdjustment(cameraCoords)
if self.wallWalkingNormalCurrent and gEnableTilt then
local viewModelTiltAngles = Angles()
viewModelTiltAngles:BuildFromCoords(cameraCoords)
local wallWalkingNormalCoords = BuildCoords(self.wallWalkingNormalCurrent, cameraCoords.zAxis)
local wallWalkingRoll = Angles()
wallWalkingRoll:BuildFromCoords(wallWalkingNormalCoords)
wallWalkingRoll = wallWalkingRoll.roll
self.goalCameraRoll = (wallWalkingRoll * Skulk.kCameraRollTiltModifier)
if self.currentCameraRoll then
viewModelTiltAngles.roll = viewModelTiltAngles.roll + self.currentCameraRoll
end
local viewModelTiltCoords = viewModelTiltAngles:GetCoords()
viewModelTiltCoords.origin = cameraCoords.origin
return viewModelTiltCoords
end
return cameraCoords
end
function OnCommandSkulkViewTilt(enableTilt)
gEnableTilt = enableTilt ~= "false"
end
Event.Hook("Console_skulk_view_tilt", OnCommandSkulkViewTilt)
//
// lua\Skulk_Client.lua
//
// Created by: Brian Cronin (brianc@unknownworlds.com)
//
// ========= For more information, visit us at http://www.unknownworlds.com =====================
Skulk.kCameraRollSpeedModifier = 1
Skulk.kCameraRollTiltModifier = 1
function Skulk:UpdateMisc(input)
Alien.UpdateMisc(self, input)
if self.currentCameraRoll == nil then
self.currentCameraRoll = 0
end
if self.goalCameraRoll == nil then
self.goalCameraRoll = 0
end
self.currentCameraRoll = LerpGeneric(self.currentCameraRoll, self.goalCameraRoll, math.min(1, input.time *
Skulk.kCameraRollSpeedModifier))
end
local gEnableTilt = true
// Tilt the camera based on the wall the Skulk is attached to.
function Skulk:PlayerCameraCoordsAdjustment(cameraCoords)
if self.wallWalkingNormalCurrent and gEnableTilt then
local viewModelTiltAngles = Angles()
viewModelTiltAngles:BuildFromCoords(cameraCoords)
local wallWalkingNormalCoords = BuildCoords(self.wallWalkingNormalCurrent, cameraCoords.zAxis)
local wallWalkingRoll = Angles()
wallWalkingRoll:BuildFromCoords(wallWalkingNormalCoords)
wallWalkingRoll = wallWalkingRoll.roll
self.goalCameraRoll = (wallWalkingRoll * Skulk.kCameraRollTiltModifier)
if self.currentCameraRoll then
viewModelTiltAngles.roll = viewModelTiltAngles.roll + self.currentCameraRoll
end
local viewModelTiltCoords = viewModelTiltAngles:GetCoords()
viewModelTiltCoords.origin = cameraCoords.origin
return viewModelTiltCoords
end
return cameraCoords
end
function OnCommandSkulkViewTilt(enableTilt)
gEnableTilt = enableTilt ~= "false"
end
Event.Hook("Console_skulk_view_tilt", OnCommandSkulkViewTilt)