|
|
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
Serious User
|
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
OP
User
|
OP
User
Joined: Sep 2009
Posts: 987
Budapest
|
In my opening post this was my question: 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 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
Serious User
|
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: Aku_Aku]
#338832
08/21/10 22:15
08/21/10 22:15
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
Expert
|
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: Aku_Aku]
#338889
08/22/10 12:23
08/22/10 12:23
|
Joined: Sep 2009
Posts: 987 Budapest
Aku_Aku
OP
User
|
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?
|
|
|
Moderated by mk_1, Perro, rayp, Realspawn, Rei_Ayanami, rvL_eXile, Spirit, Superku, Tobias, TSG_Torsten, VeT
|