• Adding model on viewmodel?
    3 replies, posted
I'm looking to add a small screen to the Physgun viewmodel. I'm trying two approaches to set its angles and positions: https://youtu.be/_B-vKRUo154 As you can see, the view model based approach works fairly well, until the 'fire' animation plays, in which case the viewmodel's angles/positions don't actually change, resulting in the screen 'dislocating' itself from the viewmodel. The attachment based approach DOES consider weapon animations, but for reasons beyond me also results in constant dislocations when the viewmodel bobs. (I have a custom viewmodel bobbing script here performed on the CalcViewModelView hook). What is the CORRECT way of doing this so it perfectly moves together with both viewmodel bobbing AND animations?
What about GetAttachment(0) ? I know bones etc are very wierd in GLua and some tables start at 0
Wasn't the solution, this ended up working perfectly: https://files.facepunch.com/forum/upload/710/f2e5b298-49b0-4f00-8e69-6a4b1ebeab89/image.png I had to look for the right bone (manually going through each one...) that didn't cause the screen to get misaligned when shooting the Physgun, which turned out to be bone 36 called 'square'. I actually didn't have to set a position offset, the viewModel:GetBonePosition(36) ended up placing the screen just where I wanted: https://files.facepunch.com/forum/upload/710/12cba1fd-482b-4edb-a74d-29b85ebfa5e4/image.png
better to use bone names in case of custom model replacements imo
Sorry, you need to Log In to post a reply to this thread.