3 registered members (Ayumi, Akow, AndrewAMD),
1,505
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
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
Member
|
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: JazzDude]
#170571
12/05/07 00:26
12/05/07 00:26
|
Joined: Sep 2006
Posts: 292
Mythran
Member
|
Member
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: vlau]
#170574
12/06/07 03:49
12/06/07 03:49
|
Joined: Sep 2003
Posts: 733 Whitefish, Montana
JazzDude
OP
User
|
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]
#170576
12/06/07 17:30
12/06/07 17:30
|
Joined: Mar 2003
Posts: 4,264 Wellington
Nems
.
|
.
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.
|
|
|
|