Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
4 registered members (dr_panther, Quad, AndrewAMD, 7th_zorro), 945 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
sometimes strange behaviour of vec_for_vertex #300309
12/01/09 13:18
12/01/09 13:18
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Hi,

our actors consist of 2 models: head and the rest.

We use vec_for_vertex to place the head onto the body.
This works fine, but in some few situations the head is set a few pixels too far in front.

We have some invisible dummies at every door in every room.
After loading the room we get the position of one of those dummies, create the actor with ent_create and set him to this position. Directly after this we create the head entity, use vec_for_vertex to place it and then the position of the head is updated every frame by also using vec_for_vertex.

This works fine in over 20 rooms ... but we have 2 positions in 2 rooms where the head is placed a few pixel away from the position he should be. As the actor plays a stand-animation you can see that the head also moves slightly with the animation, so that we can be sure head update is running.

It seems like we would not get the vertex position we requested, but the position of a vertex near to it.

Strange is also that once we move the actor the head position gets updated right. The described behaviour can only be seen while actor and head were created and the stand animation is playing. After moving the actor the head is placed right even when the stand animation is playing.

As those places are always the same and can be reproduced every time, there must be something special at this position, but I don't have any clue where to search.

Have you any idea why this could happen?

Best regards,
Pegamode.

Re: sometimes strange behaviour of vec_for_vertex [Re: pegamode] #300311
12/01/09 13:43
12/01/09 13:43
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
The first idea is that you move the head with some collision detection, instead of just placing it. This would explain that it's slightly off when it collides with some wall.

Re: sometimes strange behaviour of vec_for_vertex [Re: jcl] #300312
12/01/09 13:45
12/01/09 13:45
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
That was one of my first thoughts, too ... but the head is set to PASSABLE and the code looks like this:

Code:
void set_head_position(CHARACTER* c) {	
	if (c->head == NULL) return;	
	VECTOR tmp;
	vec_for_vertex(tmp, c.entity, c.headVertex);	
	c->head.x = tmp.x;
	c->head.y = tmp.y;
	c->head.z = tmp.z;	
}



So there should be no collision detection at all.

Re: sometimes strange behaviour of vec_for_vertex [Re: pegamode] #300423
12/02/09 12:49
12/02/09 12:49
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Hmm, then I have no immediate idea.

The next strategy would be to find the difference of the 2 rooms where this happens. Maybe the actor is placed at a different height there, or it was not seen by the camera before the head was placed, or something like that. That could give a hint where to look further.

Re: sometimes strange behaviour of vec_for_vertex [Re: jcl] #300435
12/02/09 14:55
12/02/09 14:55
Joined: Dec 2005
Posts: 116
T
tD_Datura_v Offline
Member
tD_Datura_v  Offline
Member
T

Joined: Dec 2005
Posts: 116
Some potentially irrelevant questions:
By default, what are local vars and structs initialized to?
"dplay_smooth", model attachment friend or foe?
Passable entities and water detection. My head is not an ocean. Or is it?
Dummy room placement. How many dummies are active? Which one is the right one? Do the old ones still linger in the room?








Re: sometimes strange behaviour of vec_for_vertex [Re: tD_Datura_v] #300503
12/02/09 20:10
12/02/09 20:10
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
dplay_smooth is for multiplayer games ... this is a singleplayer game.

The head is passable ... so no collision detection.

The entities are the right ones ...

Re: sometimes strange behaviour of vec_for_vertex [Re: pegamode] #301155
12/08/09 16:36
12/08/09 16:36
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
It seems like we solved the problem.

Even though the head is set directly by Entity.x and is set to PASSABLE it seems like we need to set also the POLYGON flag.

I'll check this within the next two days by switching the code.

Regards,
Pegamode.

Re: sometimes strange behaviour of vec_for_vertex [Re: pegamode] #301260
12/09/09 09:35
12/09/09 09:35
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
The POLYGON flag should have no influence on where you placed the head. Only when you move it with c_move, of course.

When you don't find the reason, you could contact Support and send them an example - they'll look into it to make sure that it's no engine bug. Which is however very unlikely in this case.

Re: sometimes strange behaviour of vec_for_vertex [Re: jcl] #301265
12/09/09 10:22
12/09/09 10:22
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
I agree ... I couldn't get any sense to this, too.

So I switched the code back and now the head's position is correct also without the POLYGON flag.

Currently I think that it's neither an engine bug nor something in the code, but something in the body model.
I'll check the svn-repository if there were any changes on the character-model during the same time I added the POLYGON flag.


Moderated by  old_bill, Tobias 

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