4 registered members (M_D, AndrewAMD, Quad, Ayumi),
810
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
properly attaching
#464596
02/28/17 14:27
02/28/17 14:27
|
Joined: Nov 2016
Posts: 31
middleagechinese
OP
Newbie
|
OP
Newbie
Joined: Nov 2016
Posts: 31
|
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?
Hello, it is me,
Middleagedchineseman!
Note: Not actually Chinese, nor middle age
|
|
|
Re: properly attaching
[Re: middleagechinese]
#464598
02/28/17 15:25
02/28/17 15:25
|
Joined: Dec 2011
Posts: 1,823 Netherlands
Reconnoiter
Serious User
|
Serious User
Joined: Dec 2011
Posts: 1,823
Netherlands
|
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.
Last edited by Reconnoiter; 02/28/17 15:26.
|
|
|
Re: properly attaching
[Re: Reconnoiter]
#464611
03/01/17 12:02
03/01/17 12:02
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
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);
POTATO-MAN saves the day! - Random
|
|
|
|