• SetPoseParameter() issues?
    3 replies, posted
Been having issues with SetPoseParameter() Setting this on a vehicle. Although the method im trying currently isn't the greatest, it's just temporary, but isn't working. The PoseParameter is being set, as I've checked by printing it. But the vehicle itself isn't changing [CODE] hook.Add( 'Think', 'removethisshitplz', function() for i, ent in ipairs( ents.FindByClass( 'prop_vehicle_jeep' ) ) do if ent:GetVehicleClass() ~= 'trashmaster_sgm' then continue end local TargetPos = 0.0 ent.isSwitching = true if not ent.PosePosition then ent.PosePosition = 0 end if ( ent.isSwitching ) then TargetPos = 1.0 end ent.PosePosition = math.Approach( ent.PosePosition, TargetPos, FrameTime() * 5.0 ) ent:SetPoseParameter( 'trash', ent.PosePosition ) ent:InvalidateBoneCache() for i = 0, ent:GetNumPoseParameters() - 1 do if ent:GetPoseParameterName( i ) ~= 'trash' then continue end local min, max = ent:GetPoseParameterRange( i ) print( ent:GetPoseParameterName( i ) .. ' ' .. min .. ' / ' .. max .. ' val: ' .. ent:GetPoseParameter( ent:GetPoseParameterName( i ) ) ) end end end ) [/CODE] And here's the output in console: [CODE] trash 0 / 1 val: 0.072701215744019 trash 0 / 1 val: 0.16654241085052 trash 0 / 1 val: 0.25908905267715 trash 0 / 1 val: 0.32723009586334 trash 0 / 1 val: 0.39709493517876 trash 0 / 1 val: 0.46435895562172 trash 0 / 1 val: 0.53067594766617 trash 0 / 1 val: 0.59867006540298 trash 0 / 1 val: 0.67207336425781 trash 0 / 1 val: 0.74110549688339 trash 0 / 1 val: 0.81410884857178 trash 0 / 1 val: 0.88299804925919 trash 0 / 1 val: 0.96027100086212 trash 0 / 1 val: 1 trash 0 / 1 val: 1 trash 0 / 1 val: 1 trash 0 / 1 val: 1 trash 0 / 1 val: 1 [/CODE] Any ideas? Oh just wanna let you know, I tried a different way of doing this, and it didn't work. So I just ripped some code from the [URL="https://github.com/garrynewman/garrysmod/blob/master/garrysmod/gamemodes/sandbox/entities/entities/gmod_button.lua#L154"]gmod_button[/URL] entity, and just changed some shit, and still didn't work ;( Thanks :D
bumpity bump
I'm guessing the Think hook is too early to call this and is probably overwritten later. Try Entity:AddCallback with BuildBonePositions and try to do it inside the callback.
[QUOTE=Zeh Matt;51300382]I'm guessing the Think hook is too early to call this and is probably overwritten later. Try Entity:AddCallback with BuildBonePositions and try to do it inside the callback.[/QUOTE] Hm, will look into that, thanks ;) Edit: Turns out that wasn't the issue, same output into console, and no change in the model itself. I'll look into it more though. [editline]3rd November 2016[/editline] Found the issue, thanks anyways :D
Sorry, you need to Log In to post a reply to this thread.