• PointShop: Can't get model position right using PAC3
    4 replies, posted
After some extensive Googling, I found this code: [sp] [B]THIS CODE DOESN'T WORK PROPERLY[/B] - or maybe it does and I'm bad [CODE]function ITEM:ModifyClientsideModel(ply, model, pos, ang) model:SetModelScale(1,1,1) -- Scale of the ITEM.Model, x,y,z. Pretty sure. pos = pos + (ang:Forward() * 0) + (ang:Up() * 0) + (ang:Right() * 0) -- Position points starting at the Attachment or bone on the player. The direction is fairly self-explanatory. Numbers can be + or - ang:RotateAroundAxis(ang:Forward(), 0) -- Rotation on the axis in 360 degrees. ang:RotateAroundAxis(ang:Up(), 0) ang:RotateAroundAxis(ang:Right(), 0) return model, pos, ang end[/CODE] OP: [URL="https://www.reddit.com/r/gmod/comments/48uhnr/pointshop_hats_not_fixing_to_playermodels/d0mnhs6"]reddit.com/48uhnr[/URL][/sp] [B][U]Update![/U][/B] This is the code that works properly: [CODE]function ITEM:ModifyClientsideModel(ply, model, pos, ang) model:SetModelScale(SCALE, 0) pos = pos + (ang:Forward() * X) + (ang:Right() * -Y) + (ang:Up() * Z) ang:RotateAroundAxis(ang:Right(), -PITCH) ang:RotateAroundAxis(ang:Up(), YAW) ang:RotateAroundAxis(ang:Forward(), ROLL) return model, pos, ang end[/CODE] Provided by [URL="https://facepunch.com/showthread.php?t=1302297&p=47683883&viewfull=1#post47683883"]Mornedil[/URL]. Careful with the Y and PITCH values, you have to "negate" them (see OP provided or my copy-pasta explanation here: [url]https://facepunch.com/showthread.php?t=1534079&p=51038320&viewfull=1#post51038320[/url] Original post: [SP]Using PAC3, I was able to achieve this: [IMG]https://s22.postimg.org/4rs2m3v9t/PAC3modelpos.png[/IMG] Then I transferred the values over to my PointShop item: [CODE]ITEM.Name = 'Test Item' ITEM.Price = 0 ITEM.Model = 'models/banana/banana.mdl' ITEM.Attachment = 'eyes' function ITEM:OnEquip(ply) ply:PS_AddClientsideModel(self.ID) end function ITEM:OnHolster(ply) ply:PS_RemoveClientsideModel(self.ID) end function ITEM:ModifyClientsideModel(ply, model, pos, ang) model:SetModelScale(1,1,1) -- Scale of the ITEM.Model, x,y,z. Pretty sure. pos = pos + (ang:Forward() * 1.906) + (ang:Up() * -0.057) + (ang:Right() * -73.516) ang:RotateAroundAxis(ang:Forward(), -6.891) -- Rotation on the axis in 360 degrees. ang:RotateAroundAxis(ang:Up(), -0.75) ang:RotateAroundAxis(ang:Right(), 0) return model, pos, ang end[/CODE] And the result was this: [IMG]https://s15.postimg.org/b8hstsl7v/GModhatpos.png[/IMG] What am I doing wrong? I've tried flipping "pos = pos" and "ang:" but it results in a pretty similar position. Oh, this also happens with every model of mine. Is there another tool I can use to get the position for these models?[/SP]
Try opening a support ticket with Kamshak on Scriptfodder
[QUOTE=MexicanR;51036809]Try opening a support ticket with Kamshak on Scriptfodder[/QUOTE] I'm not using any of their scripts (so no support ticket). Using "PointShop by undefined," the free one.
[QUOTE=paladynne;51036892]I'm not using any of their scripts (so no support ticket). Using "PointShop by undefined," the free one.[/QUOTE] try chaning the postion (pos = pos + (ang:Forward() * 1.906) + (ang:Up() * -0.057) + (ang:Right() * -73.516)) manually as one user in redit already told you for example. Its a pain in the ass, but... Better than nothing right?
[QUOTE=geferon;51037835]try chaning the postion (pos = pos + (ang:Forward() * 1.906) + (ang:Up() * -0.057) + (ang:Right() * -73.516)) manually as one user in redit already told you for example. Its a pain in the ass, but... Better than nothing right?[/QUOTE] Blegh. Was hoping it wouldn't resort to that >.> [editline]12th September 2016[/editline] [B]UPDATE:[/B] I f*ckin' fixed it! Well, I finally figured out how to use the original piece of code I found. For future Googlers, here's what to do: Using [URL="https://steamcommunity.com/sharedfiles/filedetails/?id=104691717"]PAC3[/URL], position the model how you want it. [B]IMPORTANT![/B] if making a hat for PointShop, make sure to set the "bone" to "eyes" (just double-click to type). The PAC3 values translations: [I]position[/I] X Y Z [I]angles[/I] PITCH YAW ROLL Replace the values into this code, as provided by [URL="https://facepunch.com/showthread.php?t=1302297&p=47683883&viewfull=1#post47683883"]Mornedil[/URL]: [CODE] function ITEM:ModifyClientsideModel(ply, model, pos, ang) model:SetModelScale(SCALE, 0) pos = pos + (ang:Forward() * X) + (ang:Right() * -Y) + (ang:Up() * Z) ang:RotateAroundAxis(ang:Right(), -PITCH) ang:RotateAroundAxis(ang:Up(), YAW) ang:RotateAroundAxis(ang:Forward(), ROLL) return model, pos, ang end [/CODE] [B]IMPORTANT![/B] this code is a bit weird, in that you need to "negate" the values from PAC3 for this code's [B]-Y[/B] and [B]-PITCH[/B] If PAC3 shows -3.5 for the Y position, you'll have to make it 3.5 (positive) and 5.5 for PITCH, you'll have to make it -5.5. Replace [B]SCALE[/B] from the code with the value PAC3 gives you for "scale z z z" All "z" values should be the same number, so if you get "scale 2 2 2" replace [B]SCALE[/B] with just one "2" ( it should then look like [I]model:SetModelScale(2, 0)[/I] )
Sorry, you need to Log In to post a reply to this thread.