Can you clear Setparentattachment?

TheMightyGerbil

L2: Junior Member
Dec 23, 2012
79
21
I've successfully "setparent" a player to a model and then "setparentattachment" the player to the attachment point but "clearparent" doesn't release the player. If I only "setparent" then "clearparent" it works.

I'm guessing but it seems like there has to be another keyvalue that setparentattachment sets on the player that needs to be cleared.

The only thread I've found referring to this is on CSGO https://gamebanana.com/threads/194852 where he mentions using AddOutput > movetype 1 to fix it but this does not appear to work.
 
Last edited:

Izotope

Sourcerer
aa
May 13, 2013
698
764
It should be working though.
Try leaving the parameter field empty when doing SetParentAttachment and see if that clears it.
 

henke37

aa
Sep 23, 2011
2,075
515
Parenting to nothing should mean parenting to the worldspawn, which should be the same as having no parent.
 

TheMightyGerbil

L2: Junior Member
Dec 23, 2012
79
21
I tried leaving the SetParentAttachment parameter blank but it didn't work. Tried 0 and "" earlier and it didn't work either, (fun side fact apparently "" parses the vmf file so it won't compile correctly.

I've got to go to sleep atm but I'll work on it more tomorrow or tonight. I'll try to make up a simplified vmf to eliminate any possibility of another entity causing the problem.
 

TheMightyGerbil

L2: Junior Member
Dec 23, 2012
79
21
After beating my head against working on a Tabletop Simulator model problem I finally got back to working on this a few hours and beating my head against it for a change, fun XD.

Worst case use a dummy entity inbetween the steps. For example, an info_target.
SetParent and SetParentAttachment the info_target to your model.
SetParent the player to the info_target and then ClearParent again.

Unfortunately this causes the same problem I get when I SetParent a player directly to a moving model. When the parent model moves it jerks the child, you, around un-smoothly and inconsistently. If I had to guess it's probably because in this mode the child's position (at least if they are a player) is updated after the parent moves while as an attachment both are updated in tandem.

At this point I've tried three things which all freed the player from being an attachment but only one is really an option, and not one I like.

1. toggle noclip. Requires using a point_servercommand, blah.
2. respawn the player. Can't find a way to respawn a single player, blarg.
3. kill the player to respawn them. I'd much rather players just be able to exit the vehicle.

Again this https://gamebanana.com/threads/194852 is the only thread I've found referencing the problem and it's solution does not appear to work so maybe I'm doing something wrong? Movetype appears to be code and not a setting you can change?

Also tried a trigger_add_tf_player_condition to see if a movement condition could reset it but that did nothing.

Attached below is a super simplified, no moving model, vmf I made for testing if anyone thinks they can get it working. Currently the second setparentattachment shows an error because I left it blank. It's blank because because no parameter I've put in worked to clear it. The following clearparent obviously doesn't clear it either.

Thanks if you have any ideas. If you don't get a quick response I have to go to sleep soon and who knows when I can get back to this.
 

Attachments

  • parenting_test.vmf
    15.4 KB · Views: 208