SWEP Upside Down?

Hello Facepunch! I’m having an issue with my sweps. When viewed in model viewer, they’re right side up. Same when spawned. However, as w_models for SWEPS, they’re upside down. I believe this is due to the direction of the hand bone in the weapon itself. Is there an easy way to mirror this bone, or at the very least use lua to draw the SWEP upside down (in this case, right side up again?)

You can’t use Lua for this ( since it is attached to a hand ), you’ll have to recompile the model and fix the bone.

I understand that, but I don’t quite get how to do it. I’m aware how to make skeletons, rig, decompile, and compile, but it isn’t letting me twist the bone for some reason. It just shows up the same in the model viewer, even when different in the smd and the .blend source.

It will not change in model viewer because it is not attached to anything there.

I attached it as a weapon to alyx.

Perfectly possible without doing this at all.

SWEP.Pos = Vector(0, 20, -5)
SWEP.Ang = Angle(0, 0, 0)

function SWEP:CreateWorldModel()
if not self.WModel then
self.WModel = ClientsideModel(self.WorldModel, RENDERGROUP_OPAQUE)
self.WModel:SetBodygroup(1, 1)
return self.WModel

function SWEP:DrawWorldModel()
local wm = self:CreateWorldModel()

local bone = self.Owner:LookupBone(“ValveBiped.Bip01_R_Hand”)
local pos, ang = self.Owner:GetBonePosition(bone)

if bone then
ang:RotateAroundAxis(ang:Right(), self.Ang.p)
ang:RotateAroundAxis(ang:Forward(), self.Ang.y)
ang:RotateAroundAxis(ang:Up(), self.Ang.r)
wm:SetRenderOrigin(pos + ang:Right() * self.Pos.x + ang:Forward() * self.Pos.y + ang:Up() * self.Pos.z)

Well, I wouldn’t call this a proper solution, since you have to create yet another entity for it.

[editline]15th May 2014[/editline]

Considering he has the model source.

It’s a work around this way, the way you were suggesting him would be the proper way to solving this.

I agree that he should fix the bone.

After another 6 hours of just trying to twist the bone in all axes, opening it up a npc model in hlmv, and attaching the weapon as a weapon only to find it in their hand, but upside down, I’ll be using Ozymandias’s method. Unless there is something I’m doing wrong, I’ll consider this solved.