3 registered members (NewbieZorro, TipmyPip, 1 invisible),
19,045
guests, and 8
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
problem with mouse_pos3d
#367939
04/20/11 08:10
04/20/11 08:10
|
Joined: Apr 2011
Posts: 40 germany
Wollez
OP
Newbie
|
OP
Newbie
Joined: Apr 2011
Posts: 40
germany
|
Hi guys, Here's my problem: I'm still writing a small strategie game. Now youre supposed to be able to send the unit somewhere by clicking on a spot on the map. So I need the world positions of the mouse. Theres something about mouse_pos3d in the manual, but I don't really get it to work.
VECTOR pos;
if (mouse_right)
{
vec_set(pos,mouse_pos3d);
}
thanks already
|
|
|
Re: problem with mouse_pos3d
[Re: Wollez]
#367960
04/20/11 11:10
04/20/11 11:10
|
Joined: Apr 2005
Posts: 274 austria
Ascalon
Member
|
Member
Joined: Apr 2005
Posts: 274
austria
|
how do you use the target position on your model ? can you show this please ?
do you use c-script or lite-c ?
Last edited by Ascalon; 04/20/11 11:24.
|
|
|
Re: problem with mouse_pos3d
[Re: Wollez]
#367994
04/20/11 14:18
04/20/11 14:18
|
Joined: Apr 2005
Posts: 274 austria
Ascalon
Member
|
Member
Joined: Apr 2005
Posts: 274
austria
|
change your
ent_create("position1.mdl",target.x,NULL);
to this
ent_create("position1.mdl",mouse_click.x,NULL);
|
|
|
Re: problem with mouse_pos3d
[Re: Wollez]
#368012
04/20/11 16:45
04/20/11 16:45
|
Joined: Jan 2002
Posts: 4,225 Germany / Essen
Uhrwerk
Expert
|
Expert
Joined: Jan 2002
Posts: 4,225
Germany / Essen
|
VECTOR mouse_click;
if (mouse_right)
{
vec_set (mouse_click, mouse_dir3d);
vec_normalize(mouse_click, 4000);
vec_add (mouse_click, mouse_pos3d);
if (c_trace(camera.x, mouse_click, IGNORE_MODELS))
ent_create ("position1.mdl",&hit->x, NULL);
}
Always learn from history, to be sure you make the same mistakes again...
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|