Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,187 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 3 of 5 1 2 3 4 5
Re: placing models on the terrain [Re: MDI] #170558
12/03/07 23:08
12/03/07 23:08
Joined: Sep 2003
Posts: 733
Whitefish, Montana
JazzDude Offline OP
User
JazzDude  Offline OP
User

Joined: Sep 2003
Posts: 733
Whitefish, Montana
Changing to hmp. That's the only thing I haven't tried. So I guess that's next.

Re: placing models on the terrain [Re: JazzDude] #170559
12/03/07 23:17
12/03/07 23:17
Joined: Aug 2005
Posts: 312
Sweden
tindust Offline
Senior Member
tindust  Offline
Senior Member

Joined: Aug 2005
Posts: 312
Sweden
I agree with MDI, use vector. But another problem is that you use redundant arguments where result was taken when not available yet. The trace should work fine with model as well as hmp since you removed ignore_model.
I did a minor adjustment to your code JazzDude that I think will work. Here it is:
Code:
function village_func()
{
my.polygon = on;
vec_set (temp, my.pos);
temp.z -= 1000;
result -= c_trace(my.pos, temp, ignore_me + ignore_sprites + use_box);
if(result){vec_set(my.pos,vector(target));}
}

function sioux_camp()
{

temp.x = -96;
temp.y = -1164;
temp.z = 300;
ent_create("tepee_village.mdl",temp,village_func);
}



Re: placing models on the terrain [Re: tindust] #170560
12/03/07 23:54
12/03/07 23:54
Joined: Sep 2003
Posts: 733
Whitefish, Montana
JazzDude Offline OP
User
JazzDude  Offline OP
User

Joined: Sep 2003
Posts: 733
Whitefish, Montana
Thanks, Tindust--

That version produces an error on this line:

if(result){vec_set(my.pos,vector(target));}

And I don't understand why you have temp_z = 300. I would think temp.z = result.

Re: placing models on the terrain [Re: JazzDude] #170561
12/04/07 00:07
12/04/07 00:07
Joined: Aug 2005
Posts: 312
Sweden
tindust Offline
Senior Member
tindust  Offline
Senior Member

Joined: Aug 2005
Posts: 312
Sweden
First, the temp_z was just arbitrarily set to somewhere above the assumed point where the trace would intersect the terrain. Result could not be used because the c_trace has not been done yet, not until the tipi villagae has been created. I don't know what value result will have, probably zero.
An alternative to the if(result)... line would be using:

temp.z = my.z - result;
vec_set(my.pos,temp);

where result is the distance of the vertical trace from its origin (me, the tipi_village) to the target (the vector position where the trace interscts the terrain).

Not sure why the other line would produce an error ... what did it say?

Re: placing models on the terrain [Re: tindust] #170562
12/04/07 03:23
12/04/07 03:23
Joined: Sep 2003
Posts: 733
Whitefish, Montana
JazzDude Offline OP
User
JazzDude  Offline OP
User

Joined: Sep 2003
Posts: 733
Whitefish, Montana
Yeah, that makes sense. You get 5 stars.

The error (E1513) Crash in village_func: vec_set(my.pos,vector(target))

Substituting the two lines left the village hanging in the air.

Code:
function village_func()
{
my.polygon = on;
vec_set (temp, my.pos);
temp.z -= 1000;
result -= c_trace(my.pos, temp, ignore_me + ignore_sprites + use_box);
temp.z = my.z - result;
vec_set(my.pos,temp);

}

function sioux_camp()
{
temp.x = -96;
temp.y = -1164;
temp.z = 300;
ent_create("tepee_village.mdl",temp,village_func);
}



Re: placing models on the terrain [Re: JazzDude] #170563
12/04/07 07:19
12/04/07 07:19
Joined: Aug 2005
Posts: 312
Sweden
tindust Offline
Senior Member
tindust  Offline
Senior Member

Joined: Aug 2005
Posts: 312
Sweden
OK, at least that's something different. That's good. I still think you need to use USE_POLYGON, to get down to the actual surface of the terrain (sorry ... stubborn). That still gives the problem of possibly getting a trace not hitting the surface. I think this code might do the trick:
Code:
function village_func()
{
my.polygon = on;
vec_set (temp, my.pos);
temp.z -= 1000;
result = -1; // makes sure to initialize result to a known value we can check against
result -= c_trace(my.pos, temp, ignore_me + ignore_sprites + use_polygon);
if(result >= 0) // acceptable value as long as trace origin is above the terrain surface
{
temp.z = my.z - result;
vec_set(my.pos,temp);
}
else
{
// if first trace did not do the job do it again
result -= c_trace(my.pos, temp, ignore_me + ignore_sprites + use_polygon);
temp.z = my.z - result;
vec_set(my.pos,temp);
}

}

function sioux_camp()
{
temp.x = -96;
temp.y = -1164;
temp.z = 300;
ent_create("tepee_village.mdl",temp,village_func);
}



edit: now, if both traces fail to hit at all the village should appear at a world z of -1.
cheerio

Last edited by tindust; 12/04/07 07:33.
Re: placing models on the terrain [Re: tindust] #170564
12/04/07 17:03
12/04/07 17:03
Joined: Sep 2003
Posts: 733
Whitefish, Montana
JazzDude Offline OP
User
JazzDude  Offline OP
User

Joined: Sep 2003
Posts: 733
Whitefish, Montana
This solution leaves the village hanging 300 up in the air.

Placing a beep in the "if" got nothing.

Placing the beep in the "else" worked.

I've tried dozens of variations of these snippets. I'm amazed that I could spend the whole day yesterday changing and testing and always end up with one of three results:
1) the village doesn't appear at all.
2) the village is in the air above the terrain.
3) the village sets on the world z of 0.

So I looked elsewhere for the problem. I tried substituting a plain box model and nothing changed. I decided to change the terrain.mdl to terrain.hmp. Can't be done unless the mesh is a regular grid which in this case it is not.

In addition to all the fine help you guys have offered here, I've looked up some of the gravity solutions in the AUM files and from other sources. None worked.

I thot the trace was going thru the surface and hitting the water plane which is at z=0. So I deleted the water plane and got the same results. What can it be tracing to if there is nothing at z = 0?

I have to believe this is a c_trace problem. This village placement occurs on a flat area of the terrain model where the vertices are not close together.

I am going to try interpolating some polygons into that area of the model and see if that makes a difference.

If that doesn't work I'm going to sacrifice a goat during the next full moon.

Many thanks to you all for taking on this problem but let's close this thread and get on with our lives. By the time I get it working I will have had time to place everything manually.

Re: placing models on the terrain [Re: JazzDude] #170565
12/04/07 17:15
12/04/07 17:15
Joined: Aug 2005
Posts: 312
Sweden
tindust Offline
Senior Member
tindust  Offline
Senior Member

Joined: Aug 2005
Posts: 312
Sweden
OK, good luck with the sacrificial kebob. If I find a few minutes I'll set up your system and see what I can find out. I need to get a solution myself in any case since I am shortly going to work on exactly the same thing, but be placing boulders and other terrain structures to improve general detailing of a "real" terrain. I'll be in touch,
cheers

Re: placing models on the terrain [Re: tindust] #170566
12/04/07 17:53
12/04/07 17:53
Joined: Jan 2006
Posts: 968
EpsiloN Offline
User
EpsiloN  Offline
User

Joined: Jan 2006
Posts: 968
Today I tested my 'shooting' code for your problem (because I remembered something...) The gun didnt hit the edges of the models , because their bounding box doesnt reach that far. I think you're experiencing the same problem here. (BTW , result = 0 means it didnt hit anything) If you try with a .hmp file I'm shure it'll work , because terrains are handled differently from models altough there are a few other problems when using terrains (models falling between two polygons).
I even set my.polygon to my model (when I tested) and it didnt worked again , so the solution is to use .hmp terrain or to move the houses with collision detection.


Extensive Multiplayer tutorial:
http://mesetts.com/index.php?page=201
placing models on the terrain [Re: EpsiloN] #170567
12/04/07 20:58
12/04/07 20:58
Joined: Sep 2006
Posts: 188
Latvia
MDI Offline
Member
MDI  Offline
Member

Joined: Sep 2006
Posts: 188
Latvia
Possible you can give me your project file! And i will try out all my used methods! What know possible i will find problem exaty!


Latvija rullē
Page 3 of 5 1 2 3 4 5

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