Gamestudio Links
Zorro Links
Newest Posts
zorro license, IB connection
by miwok. 12/06/23 16:32
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
AUM Magazine
Latest Screens
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Who's Online Now
6 registered members (miwok, AndrewAMD, TipmyPip, 3run, Quad, 1 invisible), 645 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 2 of 3 1 2 3
Re: Getting the next point on a line [Re: Aku_Aku] #338774
08/21/10 15:59
08/21/10 15:59
Joined: Dec 2008
Posts: 271
Saturnus Offline
Member
Saturnus  Offline
Member

Joined: Dec 2008
Posts: 271
I suppose there is no reliable solution for your problem yet. It's not possible to list all potential c_trave() hit points, neither with a native function nor with a workaround.

Re: Getting the next point on a line [Re: Saturnus] #338776
08/21/10 16:05
08/21/10 16:05
Joined: Sep 2009
Posts: 987
Budapest
Aku_Aku Offline OP
User
Aku_Aku  Offline OP
User

Joined: Sep 2009
Posts: 987
Budapest
You misunderstood something.
I don't want to get the list of c_trace hit points.
I would like to get the next point on the line the made by the c_trace what goes through an object. Next point after the hit.

Re: Getting the next point on a line [Re: Aku_Aku] #338781
08/21/10 16:38
08/21/10 16:38
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline
Serious User
painkiller  Offline
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
one moment, do you want the next object hit position or do you want any position in the line of the c_trace after the object?


3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB
Re: Getting the next point on a line [Re: painkiller] #338788
08/21/10 17:13
08/21/10 17:13
Joined: Sep 2009
Posts: 987
Budapest
Aku_Aku Offline OP
User
Aku_Aku  Offline OP
User

Joined: Sep 2009
Posts: 987
Budapest
In my opening post this was my question:
Quote:
How can i get the next point's coords on the same line right behind the hit?

In my weak english that means not exactly
Quote:
any position in the line of the c_trace after the object
but let it be.
Yes i want any position in the line of the c_trace after the object. If it is possible, the next position after the hit, in the line...

Re: Getting the next point on a line [Re: Aku_Aku] #338798
08/21/10 17:51
08/21/10 17:51
Joined: Aug 2009
Posts: 1,438
Spain
painkiller Offline
Serious User
painkiller  Offline
Serious User

Joined: Aug 2009
Posts: 1,438
Spain
Then it's easy.

let's say raystart is the from vector of the c_trace, length is a var, and temp and temp2 are vectors.

vec_diff(temp, hit, raystart); //now you have a vector with the orientation of c_trace's ray
vec_set(temp2, hit); //store hit in a temporal vector
vec_normalize(temp, length); //length is be the distance between the hit and the position that you want
vec_add(temp2, temp); //now temp2 is a position in the line of the c_trace. The separation from the hit pos is the value that you set in length.

Last edited by painkiller; 08/21/10 17:52.

3D Gamestudio A8 Pro
AMD FX 8350 4.00 Ghz
16GB RAM
Gigabyte GeForce GTX 960 4GB
Re: Getting the next point on a line [Re: painkiller] #338800
08/21/10 17:59
08/21/10 17:59
Joined: Sep 2009
Posts: 987
Budapest
Aku_Aku Offline OP
User
Aku_Aku  Offline OP
User

Joined: Sep 2009
Posts: 987
Budapest
Thanks for your efforts.
I'll try out your solution.

Re: Getting the next point on a line [Re: Aku_Aku] #338832
08/21/10 22:15
08/21/10 22:15
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
I still dont get it...
Do you want to get the next point on the trace-line that is...
Q1> "just inside" the hit object?
Q2> "just outside" the FAR SIDE of the hit object?

A1> In theory, to get my 'Q1' (and store in VECTOR temp) is this...
vec_lerp(temp.x, start.x, hit.x, (vec_dist(start.x,hit.x)+1)/vec_dist(start.x,hit.x));
or if you have already "captured" the result-distance in your previous trace, it looks like
vec_lerp(temp.x, start.x, hit.x, (dist+1)/dist);
(the "+1" in the formulas can be made smaller to improve precision)

A2> To find 'Q2', I suggest a second trace starting from hit.x,
and EXPECT it to hit the inside of a polygon on the far-side of the model.
Then you have a new hit.x that is almost "out the other side".
You can then take this position as is, or push it a little "further out"
by either my 'Q1' answer, or painkillers one.


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: Getting the next point on a line [Re: EvilSOB] #338860
08/22/10 09:27
08/22/10 09:27
Joined: Sep 2009
Posts: 987
Budapest
Aku_Aku Offline OP
User
Aku_Aku  Offline OP
User

Joined: Sep 2009
Posts: 987
Budapest
I need the next point. Q2 doesn't exist because i can't achieve such situation where the line hit inside the surface of the object. Never... (I tried hard)

So only Q1 stays. With a little replacement: just outside...
As i wrote above, there is no other situation, only the line hits from outside the object.

Painkiller proposed a solution, now i play with that.
His solution more or less identical with yours A2.
There are problems with this method, now i try to experiment a working one.

Re: Getting the next point on a line [Re: Aku_Aku] #338889
08/22/10 12:23
08/22/10 12:23
Joined: Sep 2009
Posts: 987
Budapest
Aku_Aku Offline OP
User
Aku_Aku  Offline OP
User

Joined: Sep 2009
Posts: 987
Budapest
I observed a strange thing, in my system (A7 Comm., latest version 7.86).
My level contains 3 cubes, 1 big, 1 mediocre, 1 little.
The little is inside the mediocre, and that is inside the big.
Let the name of the sides A, B, C, D.
I use standard, default lighting.
My script is able to detect all the three objects in a row, when the camera sees those to the sides A or B of cubes.
When the camera sees the C or D sides (those are darker, maybe those are in the shadow) the script is able only the big and sometimes the mediocre cube. The little one never.
What should be the reason?

Re: Getting the next point on a line [Re: painkiller] #338893
08/22/10 12:58
08/22/10 12:58
Joined: Sep 2009
Posts: 987
Budapest
Aku_Aku Offline OP
User
Aku_Aku  Offline OP
User

Joined: Sep 2009
Posts: 987
Budapest
Dear painkiller!
I tried your solution, but the distance between the hit and the new point is zero. It doesn't work.

Page 2 of 3 1 2 3

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