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 (M_D), 1,430 guests, and 3 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
Page 4 of 5 1 2 3 4 5
Re: placing models on the terrain [Re: MDI] #170568
12/04/07 21:09
12/04/07 21:09
Joined: Sep 2006
Posts: 292
M
Mythran Offline
Member
Mythran  Offline
Member
M

Joined: Sep 2006
Posts: 292
function SetToFloor()
{
var altitude;
temp.x=my.x;
temp.y=my.y;
temp.z=my.z;
vec_set(temp2,temp);
temp2.z=-4000;
trace_mode= ignore_me + ignore_you + use_box + IGNORE_PASSABLE + IGNORE_MODELS ;
trace(temp,temp2);
altitude=target.z-10;
my.z=altitude;
my.shadow = on; //If you want it to have it's own shadow.
my.material=mat_wood;
my.ambient=85;
mat_model.albedo = 2;

}

It might need a bit of changes to you own likenings, just place this functions on the models you want to be set to floor.

placing models on the terrain [Re: Mythran] #170569
12/04/07 21:22
12/04/07 21:22
Joined: Sep 2006
Posts: 188
Latvia
MDI Offline
Member
MDI  Offline
Member

Joined: Sep 2006
Posts: 188
Latvia
HEHE! I use similiar method to put objects on ground with mouse help, but what know possible this could help too!


Latvija rullē
Re: placing models on the terrain [Re: MDI] #170570
12/04/07 22:01
12/04/07 22:01
Joined: Sep 2003
Posts: 733
Whitefish, Montana
JazzDude Offline OP
User
JazzDude  Offline OP
User

Joined: Sep 2003
Posts: 733
Whitefish, Montana
Mythran : Your code places the models far below the terrain surface. Perhaps it works for you because it's tracing to a block or hmp instead of a model.

MDI : I will PM you.

Re: placing models on the terrain [Re: JazzDude] #170571
12/05/07 00:26
12/05/07 00:26
Joined: Sep 2006
Posts: 292
M
Mythran Offline
Member
Mythran  Offline
Member
M

Joined: Sep 2006
Posts: 292
Alright JazzDude i just got your mail, i've checked it, and everything works with me.

I use this script to all static objects, that i want my player to collide and do not pass through. Also is where i attached the function set to floor as you can see.

action PlayerCollide()
{
enable_polycollision = 2; // Enable poly collision (obviosly)
my.shadow = on;
my.entity_type = 1;
my.passable = off;
my.polygon = on;
wait(1);
c_updatehull(my,1);
settofloor();
}

This is the function i previously gave you. You might want to place this is the same file, *.wdl, but you must place the function set to floor before the action PlayerCollide

function SetToFloor()
{
var altitude;
temp.x=my.x;
temp.y=my.y;
temp.z=my.z;
vec_set(temp2,temp);
temp2.z=-4000;
trace_mode= ignore_me + ignore_you + use_box + IGNORE_PASSABLE + IGNORE_MODELS ;
trace(temp,temp2);
altitude=target.z-10;
my.z=altitude;
my.shadow = off; //If you want it to have it's own shadow.
my.ambient=85;
mat_model.albedo = 2;

}

I hope i'm not being too confusing, waiting for you're answer.
Also don't forget to add the action to the models you want to set to the floor.
I'm using a hmp terrain... What's the terrain maker you're using?

Edit: You can also do an action just to place models on the floor for
example:

Function settofloor()
{
...
}

Action ModelToFloor()
{
settofloor();
}

Edit Again lol: I only saw that you're using a model as terrain, you can convert it to a hmp in med... Or you can make an action to set to terrain, give it a polycollision and it might work aswell even being a model.

If the model don't stay on you're model (terrain) try to add this code to the
model (terrain) and then try again.

Action terrain()
{
enable_polycollision = 2;
my.polygon = on;
my.passable = off;
}

Last edited by Mythran; 12/05/07 00:35.
Re: placing models on the terrain [Re: Mythran] #170572
12/05/07 01:45
12/05/07 01:45
Joined: Sep 2003
Posts: 733
Whitefish, Montana
JazzDude Offline OP
User
JazzDude  Offline OP
User

Joined: Sep 2003
Posts: 733
Whitefish, Montana
Thanks, but I won't be able to mess with it until tomorrow.

Re: placing models on the terrain [Re: JazzDude] #170573
12/05/07 15:41
12/05/07 15:41
Joined: Aug 2005
Posts: 1,558
HK
V
vlau Offline
Serious User
vlau  Offline
Serious User
V

Joined: Aug 2005
Posts: 1,558
HK
Have you check the pivot point of your models in MED?

Re: placing models on the terrain [Re: vlau] #170574
12/06/07 03:49
12/06/07 03:49
Joined: Sep 2003
Posts: 733
Whitefish, Montana
JazzDude Offline OP
User
JazzDude  Offline OP
User

Joined: Sep 2003
Posts: 733
Whitefish, Montana
Mythran : No success with that solution. I'm quite sure it's because my terrain is a model.

From the manual:
Quote:

Convert to Terrain Converts the MDL model to a HMP terrain if its mesh is a regular grid.




My mesh is not a "regular grid".

Vlau: Yes, origin at the bottom.

Last edited by JazzDude; 12/06/07 03:52.
Re: placing models on the terrain [Re: JazzDude] #170575
12/06/07 17:01
12/06/07 17:01
Joined: Sep 2006
Posts: 292
M
Mythran Offline
Member
Mythran  Offline
Member
M

Joined: Sep 2006
Posts: 292
what tool did you used to make that terrain?

Re: placing models on the terrain [Re: JazzDude] #170576
12/06/07 17:30
12/06/07 17:30
Joined: Mar 2003
Posts: 4,264
Wellington
Nems Offline

.
Nems  Offline

.

Joined: Mar 2003
Posts: 4,264
Wellington
Thanks to Frazzle, this one works for me,
Code:
function create_objects()
{
var distTrace;
wait(1);
c_setminmax(me);
my.polygon = on;
vec_set(temp, my.x);
vec_sub(temp, vector(0,0,1000));
trace_mode= ignore_me | ignore_passable | use_box;
distTrace = c_trace(my.x,temp,trace_mode);
if (distTrace> 0)
{
my.z -= distTrace;
}

}

//example function
function place_object2()
{
temp.x = 200; // place the object 200 quants in front of the creator
temp.y = 0;
temp.z = 0;
vec_rotate (temp, player.pan);//be carefull to set "current_player" to your player name.
vec_add (temp, player.x);
ent_create(object2_mdl, temp.x, create_objects);

}



Just enable polygon collision in properties or by script on your model terrain (I always use model terrains)

Last edited by Nems; 12/06/07 17:32.
Re: placing models on the terrain [Re: Nems] #170577
12/06/07 17:53
12/06/07 17:53
Joined: Sep 2006
Posts: 292
M
Mythran Offline
Member
Mythran  Offline
Member
M

Joined: Sep 2006
Posts: 292

/*QUOTE:
Just enable polygon collision in properties or by script on your model terrain (I always use model terrains) */


Thats what i told him to do...

Page 4 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