Gamestudio Links
Zorro Links
Newest Posts
Trading Journey
by M_D. 04/26/24 20:22
Help with plotting multiple ZigZag
by M_D. 04/26/24 20:03
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
M1 Oversampling
by jcl. 04/26/24 11:12
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
MT5 bridge not working on MT5 v. 5 build 4160
by EternallyCurious. 04/25/24 20:49
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (M_D, AndrewAMD, Quad, Ayumi), 810 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
properly attaching #464596
02/28/17 14:27
02/28/17 14:27
Joined: Nov 2016
Posts: 31
middleagechinese Offline OP
Newbie
middleagechinese  Offline 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 Offline
Serious User
Reconnoiter  Offline
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 Offline
Expert
Kartoffel  Offline
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
Re: properly attaching [Re: Kartoffel] #464620
03/01/17 18:13
03/01/17 18:13
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
See also the FAQ in the manual: http://www.conitec.net/beta/aAnhang_events.htm, Section "Bad timing, again".


Always learn from history, to be sure you make the same mistakes again...

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1