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

Solved Attach entity to vehicle (car)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
karaulov
Member
Join Date: Jul 2018
Old 05-17-2019 , 04:40   Attach entity to vehicle (car)
Reply With Quote #1

Sorry for strange question




How to attach object(brush entity) to vehicle ? (Moving and turning it with car.)


I tried, but I can only move it with car (like origin += neworigin - oldorigin).


How to add angles/and move coordinates with these angles ? (Full attach)

Last edited by karaulov; 05-20-2019 at 23:27.
karaulov is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 05-17-2019 , 08:43   Re: Attach entity to vehicle (car)
Reply With Quote #2

Code:
entity_set_edict(brush, EV_ENT_aiment, vehicle); entity_set_int(brush, EV_INT_movetype, MOVETYPE_FOLLOW); // May be unnecessary, test
__________________
hleV is offline
karaulov
Member
Join Date: Jul 2018
Old 05-17-2019 , 09:37   Re: Attach entity to vehicle (car)
Reply With Quote #3

I got server error :

---------------------------
Fatal error - Dedicated server
---------------------------
SV_HullForEntity: SOLID_BSP without MOVETYPE_PUSH
---------------------------
ОК
---------------------------


I change SOLID_BSP to SOLID_BBOX and ... got strange result.

It works, but brush entity attached to vehicle, got big offset from needed point.



How to works MOVETYPE_FOLLOW? Possible to simulate it manual ? (func_breakable stop works after MOVETYPE_FOLLOW)

Last edited by karaulov; 05-17-2019 at 10:04.
karaulov is offline
karaulov
Member
Join Date: Jul 2018
Old 05-17-2019 , 10:00   Re: Attach entity to vehicle (car)
Reply With Quote #4

Code:
// Just copy angles and origin of parent
void SV_Physics_Follow(edict_t *ent)
{
	// regular thinking
	if (!SV_RunThink(ent))
		return;

	edict_t	*parent = ent->v.aiment;
	if (!ent->v.aiment)
	{
		Con_DPrintf("%s movetype FOLLOW with NULL aiment\n", &pr_strings[ent->v.classname]);
		ent->v.movetype = MOVETYPE_NONE;
		return;
	}

	VectorAdd(parent->v.origin, ent->v.v_angle, ent->v.origin);
	VectorCopy(parent->v.angles, ent->v.angles);

	SV_LinkEdict(ent, TRUE);
}
from hlds code
karaulov is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-17-2019 , 11:50   Re: Attach entity to vehicle (car)
Reply With Quote #5

You could try to make your own point entity that acts as func_breakable? Setting origin to brush entities directly this way might make them act weird, aiment wasn't meant to work with them (that's why entity_set_origin exists).

The offset might be because the origin of the vehicle isn't where you need it to be? In that case, aiment might not be useful anyway, you'd still need to manipulate the entity origin to compensate for that offset... (and yeah, that would look choppy).
__________________

Last edited by <VeCo>; 05-17-2019 at 12:45.
<VeCo> is online now
karaulov
Member
Join Date: Jul 2018
Old 05-18-2019 , 00:31   Re: Attach entity to vehicle (car)
Reply With Quote #6

I tried attach for example 'func_breakable' (brush entity from map) to vehicle.

Yes, set_origin works, but not rotate func_breakable with vehicle, and with some problems.
Possible need use velocity/speed/ etc instead of change origin. But it very hard ?
karaulov is offline
karaulov
Member
Join Date: Jul 2018
Old 05-18-2019 , 00:35   Re: Attach entity to vehicle (car)
Reply With Quote #7

Quote:
Originally Posted by <VeCo> View Post
You could try to make your own point entity that acts as func_breakable? Setting origin to brush entities directly this way might make them act weird, aiment wasn't meant to work with them (that's why entity_set_origin exists).

The offset might be because the origin of the vehicle isn't where you need it to be? In that case, aiment might not be useful anyway, you'd still need to manipulate the entity origin to compensate for that offset... (and yeah, that would look choppy).


Possible aiment not works because func_breakable from map (brush) not have 'rotation point' ? It can be changed manually ?


I found https://forums.alliedmods.net/showpo...7&postcount=11 but it only for angles.

Last edited by karaulov; 05-18-2019 at 01:24.
karaulov is offline
<VeCo>
Veteran Member
Join Date: Jul 2009
Location: Bulgaria
Old 05-18-2019 , 16:48   Re: Attach entity to vehicle (car)
Reply With Quote #8

Yeah, that's another problem. It would be pretty much impossible to achieve smooth movement without aiment.
You could try mimicking the velocity instead of origin but it would be a pain with the collision checking.
__________________
<VeCo> is online now
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 05-19-2019 , 09:04   Re: Attach entity to vehicle (car)
Reply With Quote #9

If editing the brush model is an option, you could move it so it'd better align with the car.
__________________
hleV 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 11:09.


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