Raised This Month: $12 Target: $400
 3% 

SetParent that doesn't rotate prop?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kot4404
Senior Member
Join Date: Mar 2013
Old 02-03-2018 , 12:53   SetParent that doesn't rotate prop?
Reply With Quote #1

Can it be achieved? there is https://developer.valvesoftware.com/...rentAttachment
SetParentAttachment but not sure if it is what I understood from it
I want to parent prop to player so it won't change the angle but can still be moved
kot4404 is offline
Dr.Doctor
AlliedModders Donor
Join Date: Feb 2017
Location: Hong Kong
Old 02-14-2018 , 01:26   Re: SetParent that doesn't rotate prop?
Reply With Quote #2

maybe be MOVETYPE_FOLLOW?
__________________
Dr.Doctor is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 02-14-2018 , 10:28   Re: SetParent that doesn't rotate prop?
Reply With Quote #3

SetParent etc is used to attach entities to a player or another entity. If you want anything other than that you will need to just Teleport the entity to the position you want.
Mitchell is offline
SZOKOZ
Member
Join Date: Jan 2014
Old 02-16-2018 , 06:56   Re: SetParent that doesn't rotate prop?
Reply With Quote #4

SetParentAttachment should work. I guess you asked this question before trying it.
__________________
May still be available for SM scripting. Just look at my Steam profile regarding my availability.
My Steam
SZOKOZ is offline
kot4404
Senior Member
Join Date: Mar 2013
Old 02-16-2018 , 11:10   Re: SetParent that doesn't rotate prop?
Reply With Quote #5

Quote:
Originally Posted by SZOKOZ View Post
SetParentAttachment should work. I guess you asked this question before trying it.
I have actually no idea how to use it,

Code:
bool:SetParent(client, entity)
{
	SetVariantString(steamid);
	AcceptEntityInput(entity, "SetParent", 0, 0, 0);
}
this works but when I change it to
Code:
AcceptEntityInput(entity, "SetParentAttachment", 0, 0, 0);
doesn't make difference

Note: Entities must be parented before being sent this input. Use at least a 0.01 second delay between SetParent and SetParentAttachment inputs.

so I tried to do the normal setparent first and delay the attachment one with timer, but that didn't make difference either
kot4404 is offline
SZOKOZ
Member
Join Date: Jan 2014
Old 02-16-2018 , 20:05   Re: SetParent that doesn't rotate prop?
Reply With Quote #6

You need to specify an attachment.
e.g.
SetVariantString("primary");
AcceptEntityInput(entity, "SetParentAttachment");

Also those 0s you added as arguments aren't null entities. Use -1. It is -1 by default so you don't need to add anything after the input argument.
__________________
May still be available for SM scripting. Just look at my Steam profile regarding my availability.
My Steam
SZOKOZ is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 02-17-2018 , 01:31   Re: SetParent that doesn't rotate prop?
Reply With Quote #7

here is a stock I created awhile ago for parenting and using Attachements:
Code:
public void parentEntity(int child, int parent, const char[] attachment) {
    SetVariantString("!activator");
    AcceptEntityInput(child, "SetParent", parent, child, 0);
    if(!StrEqual(attachment, "", false)) {
        SetVariantString(attachment);
        AcceptEntityInput(child, "SetParentAttachment", child, child, 0);
    }
}
to parent to an entity use: parentEntity(child, parent, "");
to parent to an entity with a specific attachement point use: parentEntity(child, parent, "forward");
Mitchell is offline
kot4404
Senior Member
Join Date: Mar 2013
Old 02-17-2018 , 07:53   Re: SetParent that doesn't rotate prop?
Reply With Quote #8

Quote:
Originally Posted by Mitchell View Post
here is a stock I created awhile ago for parenting and using Attachements:
Code:
public void parentEntity(int child, int parent, const char[] attachment) {
    SetVariantString("!activator");
    AcceptEntityInput(child, "SetParent", parent, child, 0);
    if(!StrEqual(attachment, "", false)) {
        SetVariantString(attachment);
        AcceptEntityInput(child, "SetParentAttachment", child, child, 0);
    }
}
to parent to an entity use: parentEntity(child, parent, "");
to parent to an entity with a specific attachement point use: parentEntity(child, parent, "forward");
I managed to get the setparent working but I guess it wasn't what I wanted, it attaches the prop to bone but the prop is still rotating

I need to create grab command that attaches prop your looking at to your view + keep it at same distance from client all the time while maintaining the angle it had at the beginning
kot4404 is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 02-17-2018 , 14:15   Re: SetParent that doesn't rotate prop?
Reply With Quote #9

Quote:
Originally Posted by kot4404 View Post
I managed to get the setparent working but I guess it wasn't what I wanted, it attaches the prop to bone but the prop is still rotating

I need to create grab command that attaches prop your looking at to your view + keep it at same distance from client all the time while maintaining the angle it had at the beginning
Look at buildwars gamemode
Like i said before you'll need to teleort the entity instead of parenting it...
Mitchell is offline
tonline_kms65
Member
Join Date: Aug 2016
Location: Ru. Komsomol-on-Amur
Old 02-26-2021 , 22:17   Re: SetParent that doesn't rotate prop?
Reply With Quote #10

https://forums.alliedmods.net/showthread.php?t=330905

Continuation of the topic, if you can solve it-it will certainly be useful to many.
I can't decide yet either. But there must be a solution! You need to get something similar to an independent ball bearing
When it turns the body of the parent, the body of the child must remain motionless, while all other movements must strictly follow the parent.

https://youtu.be/3d8CFaKmM0U
When rotating the tank body (track), the tank tower must remain in place (without rotation), the tank body is controlled only by the keyboard. The tower of the tank is controlled only by the mouse.

Quote:
Originally Posted by Mitchell View Post
Look at buildwars gamemode
Like i said before you'll need to teleort the entity instead of parenting it...
In this case, there will be no exact following of the parent, the child will twitch when moving, and this is unacceptable!

Last edited by tonline_kms65; 02-27-2021 at 04:42.
tonline_kms65 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:34.


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