Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

E2 function holoSetPose cannot affect multiple pose parameters #55

Closed
MagnumMacKivler opened this issue Feb 27, 2018 · 17 comments
Closed
Assignees

Comments

@MagnumMacKivler
Copy link

Hello,
So I noticed a while back that the holoAnim extension had E2 functions for pose parameters, and I decided to try and make a model that uses them. I got halfway through making it work when I discovered a very strange problem; it seems that the holoSetPose() function can only affect one pose parameter at a time.

A more technical way of describing the problem is that when holoSetPose() is used to set a pose parameter, all other pose parameters appear to reset to their "zero" position.

At first I thought it was a problem with just my model, so I did a test using the HL2 Jeep/buggy model, which uses pose parameters to move the wheels up and down (among other things).

This is the test E2 I made, as you can see it's pretty simple.

@name Pose Parameter Test
@inputs Left Right
@outputs 
@persist 
@trigger 

if(first()){
    holoCreate(0,entity():pos(),vec(1),entity():angles(),vec(255),"models/buggy.mdl")
}

holoSetPose(0,"vehicle_wheel_fl_height",Left)
holoSetPose(0,"vehicle_wheel_fr_height",Right)

Controlling the first pose parameter works fine. This is what happens when I lowered the first wheel:
alt text

This is what happens when I try the other one independently:
alt text

This is where the bug occurs. Setting the First, then the Second, does this:
alt text

When the sequence is reversed, the same thing happens, but it affects the other wheel:
alt text

Examining the model in HLMV shows both wheels being controllable at the same time; This only makes sense as both source vehicles and certain addons such as Simfphys use all necessary pose parameters to make their vehicles work.
alt text

I have not tested holoGetPose() to see if it correctly retrieves the pose parameter info.

Thanks for your time and attention, and please let me know if you need any more information relating to the issue.

@bigdogmat
Copy link
Member

Wiki page doesn't seem to indicate this should happen, though it does say we should call http://wiki.garrysmod.com/page/Entity/InvalidateBoneCache. I'll give that a try once I have a chance.

@MagnumMacKivler
Copy link
Author

Thanks, I really appreciate it!

@bigdogmat
Copy link
Member

Do you have your buttons set to toggle? I've just pasted this chip but replaced the Left and Right variables with constants (0 or 1), it's working as expected.

@Monkatraz
Copy link

Monkatraz commented Mar 27, 2018

You can tell they're toggled because those buttons lights are both on at the same time.

@bigdogmat
Copy link
Member

bigdogmat commented Mar 27, 2018

I see. After testing again it I can see the issues, though I don't know of a way to fix it, my only guess would be this has to be called client side and http://wiki.garrysmod.com/page/Entity/InvalidateBoneCache has to be called. I'll give that a try tomorrow.

@CalocoDoesGit
Copy link

Any progress on this?

@thegrb93
Copy link
Contributor

thegrb93 commented Jan 21, 2019

I don't think InvalidateBoneCache is needed for serverside SetPoseParameter. I may try it tonight. I'm feeling in the fixing mood.

@thegrb93 thegrb93 self-assigned this Jan 21, 2019
@MagnumMacKivler
Copy link
Author

Awesome!

@thegrb93
Copy link
Contributor

This code works
lua_run local e=ents.FindByClass("gmod_wire_hologram")[1] hook.Add("Think","",function() local x=(math.sin(CurTime())+1)/2 for i=0, e:GetNumPoseParameters()-1 do e:SetPoseParameter(e:GetPoseParameterName(i), x) end end)

@thegrb93
Copy link
Contributor

This code works too
lua_run local e=ents.FindByClass("gmod_wire_hologram")[1] hook.Add("Think","",function() local x=(math.sin(CurTime())+1)/2 e:SetPoseParameter("vehicle_wheel_fl_height",x) e:SetPoseParameter("vehicle_wheel_fr_height",1-x) end)

@thegrb93
Copy link
Contributor

I see the problem. When you feed it a value that matches its previous value, it will reset to 0 when the other pose parameters are set.

@thegrb93
Copy link
Contributor

thegrb93 commented Jan 22, 2019

This works, but isn't a good solution.

@name Pose Parameter Test
@inputs Left Right
@outputs 
@persist 
@trigger 

if(first()){
    holoCreate(0,entity():pos(),vec(1),entity():angles(),vec(255),"models/buggy.mdl")
}

Hash = sin(curtime())/10

holoSetPose(0,"vehicle_wheel_fl_height",Left+Hash)
holoSetPose(0,"vehicle_wheel_fr_height",Right+Hash)

@thegrb93
Copy link
Contributor

thegrb93 commented Jan 22, 2019

The only solution is to network it and set them in client-side

@MagnumMacKivler
Copy link
Author

How easy/difficult would that end up being?

@thegrb93
Copy link
Contributor

Pretty easy

@thegrb93
Copy link
Contributor

serverside is done, now clientside.

@thegrb93
Copy link
Contributor

Try out #64 . Not tested fully but seems to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants