Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/05/23 14:22
Zorro Trader GPT
by TipmyPip. 12/04/23 11:34
Square root rule
by Smallz. 12/02/23 09:15
RTest not found error
by TipmyPip. 12/01/23 21:43
neural function for Python to [Train]
by TipmyPip. 12/01/23 14:47
Xor Memory Problem.
by TipmyPip. 11/28/23 14:23
Training with command line parameters
by TipmyPip. 11/26/23 08:42
Combine USD & BTC Pairs In Asset Loop
by TipmyPip. 11/26/23 08:30
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
0 registered members (), 631 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
fairtrader, hus, Vurtis, Harry5, KelvinC
19019 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
vec_rotate problem #397314
03/17/12 16:36
03/17/12 16:36
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
i defined a vector in the front of a entity
and crated a sprite at this position
Code:
vec_set(test_vec,vector(test_mdl.x-200,test_mdl.y,test_mdl.z));


everythings works but the vector does not rotates
correct with the player
it do not keep the right position in the front of the player
Code:
vec_rotate(test_vec,test_mdl.pan);


can someone help me pls?

Re: vec_rotate problem [Re: GameScore] #397317
03/17/12 16:49
03/17/12 16:49
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
First you set test_vec to a value 200 quants behind (not in front) of your test_mdl entity. Then you rotate that vector around the coordinate system's origin. But instead you want to rotate it around what point? :-)


Always learn from history, to be sure you make the same mistakes again...
Re: vec_rotate problem [Re: Uhrwerk] #397319
03/17/12 16:59
03/17/12 16:59
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
sry i mean +200

i want to rotate the point with the entity
the test_vec shoud be always in front of the entity

Re: vec_rotate problem [Re: GameScore] #397320
03/17/12 17:19
03/17/12 17:19
Joined: Apr 2005
Posts: 795
U.S.A. Michigan
exile Offline
User
exile  Offline
User

Joined: Apr 2005
Posts: 795
U.S.A. Michigan
I think this may work, but I haven't tested it

Code:
vec_set(test_vec,vector(200,0,0));
vec_sub(test_vec.x,my.x);
vec_to_angle(my.pan,test_vec.x); // now MY looks at YOU	
vec_set(whateverYouWant.x,test_vec.x);





Last edited by exile; 03/17/12 17:21.
Re: vec_rotate problem [Re: GameScore] #397322
03/17/12 17:23
03/17/12 17:23
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
I'd do this in a while loop:

vec_for_angle(thing.x, player.pan);//translate the angel of the player entity to a vector
vec_normalize(thing.x, 200);//multiply the vector with the length 1 with the wished distance
vec_add(thing.x, player.x);//add the vector to the vector of the players position

Not tested!

Re: vec_rotate problem [Re: Pappenheimer] #397325
03/17/12 17:41
03/17/12 17:41
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Code:
VECTOR temp;
while(1)
{
	vec_set(temp, vector(200,0,0));
	vec_rotate(temp, player.pan);
	vec_add(temp, player.x);
	wait(1);
}



temp will be always 200 quants in front of your player.

Re: vec_rotate problem [Re: Rei_Ayanami] #397358
03/18/12 09:59
03/18/12 09:59
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
got it
tnx for all your answer

but now i have a thing more where i cant find a solution
and it is to difficult for me to explain this in english
did someone speak german?

Re: vec_rotate problem [Re: GameScore] #397359
03/18/12 10:26
03/18/12 10:26
Joined: Aug 2007
Posts: 1,922
Schweiz
Widi Offline
Serious User
Widi  Offline
Serious User

Joined: Aug 2007
Posts: 1,922
Schweiz
Schreibe in deutsch, hier hat es eine Menge Leute die deutsch sprechen.

Re: vec_rotate problem [Re: Widi] #397360
03/18/12 10:32
03/18/12 10:32
Joined: Apr 2008
Posts: 245
GameScore Offline OP
Member
GameScore  Offline OP
Member

Joined: Apr 2008
Posts: 245
Toll!

OK
was ich machen möchte ist
ich möchte eine entity mit der maus anklicken
und von dieser position wo die entity angelickt wurde soll ein
c_trace starten ungefähr 200 quants von diesm punkt weg
im rechten winkel zur oberfläche an dieser stelle,
der trace soll sich dann mit der entity mit drehen

so schicke ich von der maus einen c_trace zur entity
an der stelle wo sie mit dem cursor berührt wird

Code:
vec_set(target_ent,mouse_dir3d);
vec_scale(target_ent,1000); // set a range
vec_add(target_ent,mouse_pos3d);

vec_set(target_pos,vector(target.x,target.y,target.z));// speichern der target position
     
c_trace(mouse_pos3d,target_ent, IGNORE_PASSABLE | USE_POLYGON| SCAN_TEXTURE);



wenn dann die entity angeklickt wird
soll von target_pos aus der trace starten



Last edited by GameScore; 03/18/12 10:38.
Re: vec_rotate problem [Re: GameScore] #397376
03/18/12 15:40
03/18/12 15:40
Joined: Jan 2002
Posts: 4,225
Germany / Essen
Uhrwerk Offline
Expert
Uhrwerk  Offline
Expert

Joined: Jan 2002
Posts: 4,225
Germany / Essen
Schau mal im Handbuch unter EVENT_CLICK nach, das ist glaube ich das Dir fehlende Puzzleteil.


Always learn from history, to be sure you make the same mistakes again...
Page 1 of 2 1 2

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