|
Question to in_solid
#260961
04/14/09 22:07
04/14/09 22:07
|
Joined: Apr 2009
Posts: 138 Germany
Toryno
OP
Member
|
OP
Member
Joined: Apr 2009
Posts: 138
Germany
|
Hello everybody, I want to place a building in a fps shooter. The building should be a few quants in front of the player and when its in a wall or in an other building, it should be red and otherwise it should be green (So that you can see if you can build it there or not). My question: why doesn't it become red when its in a wall? Here's the code ("ich" is the pointer to the player)
function Gebaeude_bauen() {
my = ent_createlocal("Geschuetz.mdl",vector(ich.x + 100 * cos(ich.pan), ich.y + 100 * sin(ich.pan), ich.z), Geschuetz);
wait(1);
c_setminmax(my);
set(my, TRANSLUCENT |LIGHT);
my.alpha = 50;
while (!Taste_bestaetigen) {
my.x = ich.x + 100 * cos(ich.pan);
my.y = ich.y + 100 * sin(ich.pan);
if (my.floor_dist > 0)
c_move(my, nullvector, vector(0, 0, -my.floor_dist), 0);
if (my.floor_dist < 0)
c_move(my, nullvector, vector(0, 0, my.floor_dist), 0);
if(in_solid) {
my.green = 0;
my.red = 255;
}
else {
my.green = 255;
my.red = 0;
}
if (Taste_abbrechen) {
ptr_remove(my);
return;
}
wait(1);
}
my = ent_create("Geschuetz.mdl", my.x, Geschuetz);
}
Last edited by Toryno; 04/15/09 00:03.
Thanks for reading, thinking, answering
|
|
|
Re: Question to in_solid
[Re: zwecklos]
#261036
04/15/09 11:23
04/15/09 11:23
|
Joined: Apr 2009
Posts: 138 Germany
Toryno
OP
Member
|
OP
Member
Joined: Apr 2009
Posts: 138
Germany
|
Now it seems to work. But only when the origin of the building is in a wall. When only a bit of it is in a wall, the building is green Has anyone an idea how i can change this? Here's the new code function Gebaeude_bauen_event() {
switch (event_type)
{
case EVENT_BLOCK:
my.green = 0;
my.red = 255;
return;
case EVENT_ENTITY:
my.green = 0;
my.red = 255;
return;
}
return;
}
function Gebaeude_bauen() {
// local erstellen
my = ent_createlocal("Geschuetz.mdl",vector(ich.x + 100 * cos(ich.pan), ich.y + 100 * sin(ich.pan), ich.z), Geschuetz);
wait(1);
c_setminmax(my);
my.emask |= (ENABLE_BLOCK | ENABLE_ENTITY);
my.event = Gebaeude_bauen_event;
set(my, TRANSLUCENT |LIGHT);
my.alpha = 50;
// verschieben
while (!Taste_bestaetigen || my.red == 255) {
my.x = ich.x + 100 * cos(ich.pan);
my.y = ich.y + 100 * sin(ich.pan);
my.green = 255;
my.red = 0;
my.floor_dist = c_trace(my.x, vector(my.x, my.y, - 2000), IGNORE_ME | IGNORE_PASSABLE) + my.min_z;
if (my.floor_dist > 0)
c_move(my, nullvector, vector(0, 0, -my.floor_dist), 0);
if (my.floor_dist < 0)
c_move(my, nullvector, vector(0, 0, -my.floor_dist), 0);
if (Taste_abbrechen) {
ptr_remove(my);
return;
}
wait(1);
}
// global erstellen
if (Index == 1) {
my = ent_create("Geschuetz.mdl", my.x, Geschuetz);
}
}
Last edited by Toryno; 04/15/09 11:28.
Thanks for reading, thinking, answering
|
|
|
Re: Question to in_solid
[Re: Widi]
#264002
05/03/09 18:30
05/03/09 18:30
|
Joined: Apr 2009
Posts: 138 Germany
Toryno
OP
Member
|
OP
Member
Joined: Apr 2009
Posts: 138
Germany
|
Yes, the bounding box is correct.
Edit: could it be the movement that makes this problem? (it's still the same code)
Last edited by Toryno; 05/03/09 18:37.
Thanks for reading, thinking, answering
|
|
|
Re: Question to in_solid
[Re: Toryno]
#264054
05/04/09 02:30
05/04/09 02:30
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
what about the bounding box of what its hitting? is it correct too?
Last edited by EvilSOB; 05/04/09 02:30.
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|