Gamestudio Links
Zorro Links
Newest Posts
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (Ayumi, Akow, AndrewAMD), 1,505 guests, and 9 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Angle between vectors #306180
01/20/10 11:35
01/20/10 11:35
Joined: Jul 2008
Posts: 128
Ukraine
BastovBros Offline OP
Member
BastovBros  Offline OP
Member

Joined: Jul 2008
Posts: 128
Ukraine
Hello again,
I am trying to find the angle between two vectors:
Code:
VECTOR vec1,vec2;
var dist1,dist2;
function tram_tam(){
ANGLE angle;
while(1){
vec_diff(vec1,mouse_position,center_of_screen);//I know the coords of center_of_screen vector, and mouse_position always changes depending on where I move the mouse
vec_diff(vec2,vector_to_right,center_of_screen);//
vector_to_right has also fixed coordiantes and it is 150 quants to the right from center_of_screen
dis1 = vec_dist(center_of_screen,mouse_position);
dist2 = vec_dist(center_of_screen, vector_to_right);
angle = acos((vec_dot(vec1,vec2))/(dist1*dist2));
wait(1);}
}


And all the time I get an error "cannot convert FIXED to 'struct ANGLE'" or "cannot convert FIXED to DOUBLE"
How to deal with it? Does anyone use the same formula to find an angle? Help please....


a generator of dull questions smile
Re: Angle between vectors [Re: BastovBros] #306185
01/20/10 12:00
01/20/10 12:00
Joined: Nov 2007
Posts: 1,143
United Kingdom
DJBMASTER Offline
Serious User
DJBMASTER  Offline
Serious User

Joined: Nov 2007
Posts: 1,143
United Kingdom
The function 'acos' returns a var, not an ANGLE struct. Change the line 'ANGLE angle' to 'var angle'.

Re: Angle between vectors [Re: DJBMASTER] #306195
01/20/10 12:38
01/20/10 12:38
Joined: Jul 2008
Posts: 128
Ukraine
BastovBros Offline OP
Member
BastovBros  Offline OP
Member

Joined: Jul 2008
Posts: 128
Ukraine
I think I tried it, then I got "cannot convert FIXED to DOUBLE". I cannot check right now, but I'll try....
yaya, it works!! thx

Last edited by BastovBros; 01/20/10 17:03.

a generator of dull questions smile

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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