properly attaching

Posted By: middleagechinese

properly attaching - 02/28/17 14:27

Hello together,

I am having a very frustrating problem, in order to attach something to an moving and/or animated model you need to use a while loop.
Since a while loop has to have an wait in it, that attached model floats a frame behind, not sticking.

How do you guys properly attach an model such as a sword or a gun to a model?
Posted By: Reconnoiter

Re: properly attaching - 02/28/17 15:25

That is probably cause the entity's animation (or movement or rotation) runs after the attachment function. Either run the attachment function after those functions (e.g. by removing the while from it and just call it every frame after those functions <- this is what I do) or use proc_mode in your attachment function. Hope that helps.
Posted By: Kartoffel

Re: properly attaching - 03/01/17 12:02

like reconnoiter said, you have to make sure that the code for attaching the object is called after the entity has been animated.

I'd do it like this:

create a function for attaching the object to your player model. you could use parameters to specify which object to attach aswell as the player model that it needs to be attached to.

void AttachObjectToPlayer(ENTITY * Player, ENTITY * Object);

inside that function you'd set the objects position like you normally do, just without a while.
and then use it in your player code like that:

ent_animate(....);
AttachObjectToPlayer(PlayerEnt, SwordEnt);
Posted By: Uhrwerk

Re: properly attaching - 03/01/17 18:13

See also the FAQ in the manual: http://www.conitec.net/beta/aAnhang_events.htm, Section "Bad timing, again".
© 2024 lite-C Forums