Gamestudio Links
Zorro Links
Newest Posts
Newbie Questions
by fairtrader. 12/06/23 11:29
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
7 registered members (fairtrader, Quad, miwok, Martin_HH, AndrewAMD, alibaba, dpn), 581 guests, and 0 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
giving c_trace a direction? #287338
08/31/09 13:37
08/31/09 13:37
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
ok..

you know that you´re able to trace below the object with
Code:
c_trace(my.x, vector(my.x, my.y, my.z-100), ...);



But when i rotate the model, i want to trace to his new-below automatical now.

Example (yellow = object, red = trace ):



Question: Can someone give me a script to do that??? (me=noob at trigonometrics )

Last edited by Espér; 08/31/09 13:38.

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: giving c_trace a direction? [Re: Espér] #287342
08/31/09 14:00
08/31/09 14:00
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
please:

your_point.x = cos(my.pan)*play_with_this_value; //like 100 for max 100 quants below
your_point.y = sin(my.pan)*play_with_this_value; //like 100 for max 100 quants below
your_point.z = cos(my.tilt)*play_with_this_value; //like 100 for max 100 quants below

Re: giving c_trace a direction? [Re: Espér] #287343
08/31/09 14:00
08/31/09 14:00
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
If you want to learn the 3DGS related trigonometry, look out for the Kinji Vector Tutorials, they are unbelievable easy.

You need this:

VECTOR temp;//in case you didn't already define it

vec_set(temp, my.pan);
temp.tilt -= 90;//turn the angle to look below the entity
vec_for_angle(temp, temp);//transform the angle to a direction
vec_scale(temp, 4000);//
vec_add(temp, my.x);//add the new values to the position of the Entity

c_trace(my.x, temp, ...);

It is not tested, I tend miss or mix up things.
For testing, set the scaling to a value like the hight of your entity, and create an entity at that position, something like:

if(key_p)ent_create("star.tga", temp, NULL);

Re: giving c_trace a direction? [Re: Pappenheimer] #287359
08/31/09 15:46
08/31/09 15:46
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
hmm..

both are not working correct..

Pappenheimer.. deins bringt mir immer nen crash in der Objektaktion

Rei, in your code, my crosshair ( wich is ymbol of the new target ) stays only at the side of the object:
(the yellow spot is the point, where the crosshair should stay )



Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: giving c_trace a direction? [Re: Espér] #287370
08/31/09 16:59
08/31/09 16:59
Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Pappenheimer Offline
Senior Expert
Pappenheimer  Offline
Senior Expert

Joined: Sep 2003
Posts: 5,900
Bielefeld, Germany
Könnte sein, dass du statt 'temp.tilt' 'temp[1]' schreiben musst.

Gibt es eine genauere Fehlermeldung?

Kannst Du vielleicht die action posten, in die Du das Ganze reingesetzt hast?

Re: giving c_trace a direction? [Re: Pappenheimer] #287373
08/31/09 17:14
08/31/09 17:14
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Du kannst mit mir auch deutsch reden grin

Hmm, eigentlich müsste es gehen...

Edit: Ich habe was vegessen grin

Also nochmal
Code:
croshair.x = my.x + cos(das_teil_was_sich_dreht.pan)*die_länge_wie_weit_entfernt_sein_soll_in_quants;
croshair.y = my.y + sin(das_teil_was_sich_dreht.pan)*die_länge_wie_weit_entfernt_sein_soll_in_quants;
croshair.z = my.z + cos(das_teil_was_sich_dreht.tilt)*die_länge_wie_weit_entfernt_sein_soll_in_quants;



Muss funktinieren wink!

Re: giving c_trace a direction? [Re: Rei_Ayanami] #287375
08/31/09 17:21
08/31/09 17:21
Joined: Jul 2002
Posts: 3,208
Germany
Error014 Offline
Expert
Error014  Offline
Expert

Joined: Jul 2002
Posts: 3,208
Germany
Rei - bei dir muss in die x- und y-koordinate noch ein sin(bla.tilt). Schaut man direkt nach vorne (tilt=0) so darf ja, wenn ich das Ausgangsproblem recht verstehe, nichts bei der x und y koordinate addiert werden. Ein sin wie oben angegeben würde das korrigieren (siehe übrigens auch: Kugelkoordinaten - das hat sehr, sehr ähnliche sin/cos-geschichten ;))

keine ahnung, ob das in lite-c auch so ist, aber früher, als ich noch jung war, da gab es den befehl vec_rotate. damit wäre das ein

vec_set(temp,vector(0,0,-100)); //100 quants nach unten
vec_rotate(temp,my.pan); //oder wessen pan auch immer
vec_add(temp,my.x); //temp hat nun die gewünschte position


... mag alles falsch sein. himmel, ist das lange her


Perhaps this post will get me points for originality at least.

Check out Dungeon Deities! It's amazing and will make you happy, successful and almost certainly more attractive! It might be true!
Re: giving c_trace a direction? [Re: Error014] #287376
08/31/09 17:26
08/31/09 17:26
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Stimmt jetzt merke ich es - danke Error014 laugh

Bin auch noch neu in trigonometri grin

Re: giving c_trace a direction? [Re: Rei_Ayanami] #287382
08/31/09 18:16
08/31/09 18:16
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline OP
Expert
Espér  Offline OP
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
perfekt.. FETTES DANKE an euch alle ^^


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: giving c_trace a direction? [Re: Espér] #287388
08/31/09 18:45
08/31/09 18:45
Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
Rei_Ayanami Offline
Expert
Rei_Ayanami  Offline
Expert

Joined: Feb 2009
Posts: 3,207
Germany, Magdeburg
bitte laugh!

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