1 registered members (AndrewAMD),
1,248
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: 3d mouse_pointer
[Re: slowglider]
#337841
08/13/10 21:19
08/13/10 21:19
|
Joined: Dec 2008
Posts: 605 47°19'02.40" N 8°32'54.67" E...
hopfel
User
|
User
Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67" E...
|
I made such a code a while ago, I hope its that what you're looking for:
VECTOR kreis_pos;
ANGLE kreis_ang;
while(1)
{
vec_set(kreis_pos,vector(mouse_pos.x,mouse_pos.y,10000));
vec_for_screen(kreis_pos,camera);
my.skill1=c_trace(camera.x,kreis_pos.x,IGNORE_SPRITES + IGNORE_MODELS);
vec_to_angle(kreis_ang,vector(kreis_pos.x-camera.x,kreis_pos.y-camera.y,kreis_pos.z-camera.z));
my.x=camera.x-(-my.skill1)*cos(kreis_ang.tilt)*cos(kreis_ang.pan);
my.y=camera.y-(-my.skill1)*cos(kreis_ang.tilt)*sin(kreis_ang.pan);
my.z=camera.z-(-my.skill1)*sin(kreis_ang.tilt);
wait(1);
}
my is the entity, which follows the mouse. I think there's an easyer code but maybe you can use it. ^^
Hilf mir, dir zu helfen!
|
|
|
Re: 3d mouse_pointer
[Re: hopfel]
#337890
08/14/10 08:25
08/14/10 08:25
|
Joined: Apr 2008
Posts: 17
slowglider
OP
Newbie
|
OP
Newbie
Joined: Apr 2008
Posts: 17
|
thank buts not realy wat i want. i want to give the heigth lets say z = 5 my entity wil always be my.z == 5 but then on the mouse_position btw you reinvented the wheel there you could simple do this
vec_set(kreis_pos,vector(mouse_pos.x,mouse_pos.y,10000));
vec_for_screen(kreis_pos,camera);
my.skill1=c_trace(camera.x,kreis_pos.x,IGNORE_SPRITES + IGNORE_MODELS);
vec_set(kreis_pos,vector(mouse_pos.x,mouse_pos.y,my.skill1));
vec_for_screen(kreis_pos,camera);
vec_set(my.x,kreis_pos);
|
|
|
Re: 3d mouse_pointer
[Re: slowglider]
#337901
08/14/10 10:58
08/14/10 10:58
|
Joined: Dec 2008
Posts: 605 47°19'02.40" N 8°32'54.67" E...
hopfel
User
|
User
Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67" E...
|
i want to give the heigth lets say z = 5 my entity wil always be my.z == 5 but then on the mouse_position I think the best way for that is using trigonometry:
VECTOR kreis_pos;
ANGLE kreis_ang;
while(1)
{
vec_set(kreis_pos,vector(mouse_pos.x,mouse_pos.y,10000));
vec_for_screen(kreis_pos,camera);
vec_to_angle(kreis_ang,vector(kreis_pos.x-camera.x,kreis_pos.y-camera.y,kreis_pos.z-camera.z));
my.x=camera.x+(camera.z-5)*(tanv(kreis_ang.tilt-90))*cos(kreis_ang.pan);
my.y=camera.y+(camera.z-5)*(tanv(kreis_ang.tilt-90))*sin(kreis_ang.pan);
my.z=5;
wait(1);
}
Is it that what you mean?
Hilf mir, dir zu helfen!
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|