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
2 registered members (AbrahamR, AndrewAMD), 1,305 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
3d mouse_pointer #337268
08/09/10 20:31
08/09/10 20:31
Joined: Apr 2008
Posts: 17
S
slowglider Offline OP
Newbie
slowglider  Offline OP
Newbie
S

Joined: Apr 2008
Posts: 17

i want to create some lvl editor like in trackmania

the things is how to get te point were the mouse is on the right hight

the rest i think i can handle myself but the problem is vec_for_screen only gots a distance instead i want to have it on a certain hight like z = 0 ore somting

hope you understand me en that some can help me

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 Offline
User
hopfel  Offline
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:

Code:
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
S
slowglider Offline OP
Newbie
slowglider  Offline OP
Newbie
S

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

Code:
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 Offline
User
hopfel  Offline
User

Joined: Dec 2008
Posts: 605
47°19'02.40" N 8°32'54.67" E...
Quote:
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:

Code:
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!
Re: 3d mouse_pointer [Re: hopfel] #337921
08/14/10 13:55
08/14/10 13:55
Joined: Apr 2008
Posts: 17
S
slowglider Offline OP
Newbie
slowglider  Offline OP
Newbie
S

Joined: Apr 2008
Posts: 17
yeah many thanx it works great


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