AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   SetParentAttachment causing issues (https://forums.alliedmods.net/showthread.php?t=116150)

CrimsonGT 01-20-2010 11:01

SetParentAttachment causing issues
 
I am parenting a prop_dynamic_override to a player which works fine, but when I use SetParentAttachment, it causes some weird issues in CSS such as crouching and jumping make the player shaky. Has anyone else experienced this and found a solution?

Those issues are not present when SetParentAttachment is not used.

toazron1 01-20-2010 11:51

Re: SetParentAttachment causing issues
 
It sounds like the models are colliding with each other. I know prop hunt has a similar issue when crouching or in a corner, you could try changing the collisions

CrimsonGT 01-20-2010 11:59

Re: SetParentAttachment causing issues
 
I was having a problem initially with the player not being able to move. Once I disabled collisions through AcceptEntityInput(ent, "DisableCollision"); it worked fine and they could move, so I wouldn't think it would be a collision problem. At the same time I guess it could really be anything. Hoping someone else has had this problem before as im too sleepy to start turning off props one by one.

blodia 01-20-2010 12:11

Re: SetParentAttachment causing issues
 
toazron1 is right the models are colliding with each other, i had the same problems years ago when i was coding a ctf mod in es, i changed the collision group of the flag when it was parented and put it back to default when it was dropped or at base.

bl4nk 01-20-2010 15:33

Re: SetParentAttachment causing issues
 
Hook the CBaseEntity::ShouldCollide function and deal with it there (assuming you're not going for just a plugin-only thing).

CrimsonGT 01-20-2010 15:45

Re: SetParentAttachment causing issues
 
Quote:

Originally Posted by bl4nk (Post 1061544)
Hook the CBaseEntity::ShouldCollide function and deal with it there (assuming you're not going for just a plugin-only thing).

Well I WAS... :grrr:

Im using SDKHooks to make my life easier, but I guess I could hack it up and throw in a hook.

CrimsonGT 01-20-2010 18:18

Re: SetParentAttachment causing issues
 
Thanks for the help, I decided to print out all of the netprops as it had to be one of them. It was the m_nSolidType causing the issues. So for anyone experiencing this issue...

AcceptEntityInput(ent, "DisableCollision");

in conjunction with...

SetEntProp(ent, Prop_Send, "m_nSolidType", 0);

is what is required to prevent that shaky crap.

CrimsonGT 01-21-2010 09:30

Re: SetParentAttachment causing issues
 
Quote:

Originally Posted by bl4nk (Post 1061544)
Hook the CBaseEntity::ShouldCollide function and deal with it there (assuming you're not going for just a plugin-only thing).

Seems I cant make it not solid AND react to Touch() hook since it is using a bounding box. Although if anyone knows of a way to do so please let me know. I know it works for models with a collision mesh, but this one doesn't so bounding box is my only option.

Gonna probably just give in after class and add ShouldCollide to SDKHooks.

blodia 01-21-2010 11:39

Re: SetParentAttachment causing issues
 
if you don't mind me asking are you trying to code a ctf mod? i remember in a another thread you mentioning flag models. if so you can use env_beam as a tripwire (found out by mattie of es) instead of trying to use ontouch. also for my own ctf mod i used a physics prop instead of dynamic so when a player died the flag would fall to the ground.

CrimsonGT 01-21-2010 12:40

Re: SetParentAttachment causing issues
 
Yeah I am, its a job I am doing for someone. I wish I could use a physics prop, but it won't work since this model has no collision mesh. (Its the same one from the ES version) The tripwire isn't a bad idea, but I think it would be easier to just make a ShouldCollide hook, after all maybe someone else will need it in the future.

This is the last time I ever do a game mode mod in sourcepawn, I absolutely hate trying to manage one without OOP, gets me flustered and annoyed lol.


All times are GMT -4. The time now is 02:58.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.