Can bone controllers be set on a viewmodel from code Created 3 months ago2024-08-19 16:01:58 UTC by bruhkingsans bruhkingsans

Created 3 months ago2024-08-19 16:01:58 UTC by bruhkingsans bruhkingsans

Posted 3 months ago2024-08-19 16:01:58 UTC Post #349064
Is it possible to set a viewmodel's bone controller's value either from server-side or client-side code? I need this to move a bone programmatically, but I can't think of any other ways to do it and I've tried every way I could think of to alter the controllers value, and not a single one worked. Namely getting the weapon entity in the server-side code and setting its bone controllers is what I've tried the most.
Posted 3 months ago2024-08-19 20:09:08 UTC Post #349067
I just found out how to do it so nevermind, but here's how I did it for people in the future if they need it.
//this gets a pointer to the viewmodel
cl_entity_t* viewmodel = gEngfuncs.GetViewModel();
if (viewmodel)
{
     //I just set it to the sine of the time because that's what I need but yeah
     viewmodel->curstate.controller[0] = (sin(gpGlobals->time);
}
You must be logged in to post a response.