2 registered members (AndrewAMD, dr_panther),
730
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Is there a version of "in_solid" or "c_content" for meshes?
#351190
12/22/10 16:59
12/22/10 16:59
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
OP
Expert
|
OP
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Hi all.
Seeing as in_solid and c_content are only applicable to WED blocks, does anyone know of a way of achieving the same results with pure entity to entity collisions...
Not ACTUALLY collisions BTW. Im trying to detect if a spawned entity is completely 'within' another. That is using fully polygon detection on closed-mesh entities, and I want to know if entity-A is 'inside' entity-B, or at least if entity-A is inside 'something', without actually moving it at all. And I need it to still detect true even if there are no polygons intersecting between the entities.
Any ideas on concepts, snippets, or theories anyone ?
Thanks all...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Is there a version of "in_solid" or "c_content" for meshes?
[Re: Superku]
#351207
12/22/10 19:37
12/22/10 19:37
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
OP
Expert
|
OP
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
No luck.... c_intersect is A8 only, and I need polygon-accurate detection, not boxes.
NEXT...!
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Is there a version of "in_solid" or "c_content" for meshes?
[Re: EvilSOB]
#351210
12/22/10 19:58
12/22/10 19:58
|
Joined: Aug 2009
Posts: 1,438 Spain
painkiller
Serious User
|
Serious User
Joined: Aug 2009
Posts: 1,438
Spain
|
do a c_trace from the model origin to the model origin, that's how I do in my project to check if the player is underwater
3D Gamestudio A8 Pro AMD FX 8350 4.00 Ghz 16GB RAM Gigabyte GeForce GTX 960 4GB
|
|
|
Re: Is there a version of "in_solid" or "c_content" for meshes?
[Re: painkiller]
#351235
12/22/10 22:49
12/22/10 22:49
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
OP
Expert
|
OP
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
sorry painkiller, thats no good either.
The model Im looking to be inside of is usually a complex shape, so its origin is not guarenteed to be 'inside' the mesh...
Next...!
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Is there a version of "in_solid" or "c_content" for meshes?
[Re: EvilSOB]
#351254
12/23/10 01:19
12/23/10 01:19
|
Joined: Mar 2006
Posts: 3,538 WA, Australia
JibbSmart
Expert
|
Expert
Joined: Mar 2006
Posts: 3,538
WA, Australia
|
For that kind of thing you'll certainly need to write your own function that cycles through the vertices of two objects. Per polygon can be slow as it is, but the fact that polygons might not even intersect (one object completely within another, as you mentioned) is killer. If both objects are convex or you can reduce them to be composed of convex parts, you could use a simplified version of the Gilbert-Johnson-Keerthi distance algorithm. Even then, you'd want them to be fairly low-poly, assuming you want to perform this calculation every frame.
I have a couple of ideas in the back of my mind that might bear fruit if we know more about what kind of situation you're dealing with, and how much control you have over it.
Jibb
Formerly known as JulzMighty. I made KarBOOM!
|
|
|
Re: Is there a version of "in_solid" or "c_content" for meshes?
[Re: JibbSmart]
#351276
12/23/10 08:41
12/23/10 08:41
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
OP
Expert
|
OP
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
I suspected (bordering on certainty) that I would need my own function for this. Im more after ideas rather than solutions... The one object completely inside another is ONE killer, there is also the fact that the 'large' object is not only NOT-convex, it may be comprised of several separate closed-meshes... Read on for more details...
I'll fill you in a bit more where I can, as much of the actual usage is secret(for now).
Simplistically, this is for a TOOL that calculate the "actual" volume of a user-supplied model(MDL), as well monitor/calculate its mass-distribution based on the models shape. ("actual" as in 'as close as I can get'...)
FPS is not too big of an issue(within limits). This is a "process" that is expected to take several seconds to complete, not run every frame. ATM I use c_rotate and the process can take up to 2 minsto process a complex model... (on a crappy PC) (FYI: the c_rotate process is seriously flawed, but it is the best result I can get so far, moving a CUBE_MDL through the entire models bounding-box and c_rotating to see if it intersects anything. This is still only giving me locations of intersections though...)
Seeing as the user is supplying the model at run-time, Ive got no control over that. It could be a simple cube, but most likely a complex shape like a humanoid... Im currently not allowing for animations, as the tools output is only applicable to static objects...
Thats all the useful info I can think of for now...
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Is there a version of "in_solid" or "c_content" for meshes?
[Re: Widi]
#351291
12/23/10 12:18
12/23/10 12:18
|
Joined: Feb 2008
Posts: 3,232 Australia
EvilSOB
OP
Expert
|
OP
Expert
Joined: Feb 2008
Posts: 3,232
Australia
|
Nice try Widi, but I cant seem to get that to work... I CANNOT get ANY c_trace's to hit the inside of the polygons for some reason... I tried a few hours ago and the traces pass straight through... Heres how I was testing it...
#include <acknex.h>
#include <default.c>
void main()
{
level_load(NULL); wait(1); vec_set(camera.x, vector(-50, 0, 15));
ent_create(CUBE_MDL, vector(20,20,20), NULL); //'spare' target
me = ent_create(CUBE_MDL, nullvector, NULL);
wait(1); c_setminmax(me);
set(me, LIGHT); vec_set(me.blue, vector(0,0,200));
VECTOR to; vec_set(to, vector(me.x, me.y, me.z+20));
while(1)
{
to.x += (key_cuu - key_cud) / 5 * time_step;
to.y += (key_cul - key_cur) / 5 * time_step;
to.z += (key_home - key_end) / 5 * time_step;
var dist = c_trace(me.x, to, USE_POLYGON);
if(dist != 0)
{ draw_line3d(me.x, COLOR_RED, 100);
draw_line3d(to, COLOR_RED, 100);
draw_point3d(hit.x, COLOR_RED, 100, 0.25);
draw_text("HITTING!", 10, 10, COLOR_RED); }
if(dist == 0)
{ draw_line3d(me.x, COLOR_BLUE, 100);
draw_line3d(to, COLOR_BLUE, 100);
draw_text("NOT hitting.", 10, 10, COLOR_BLUE); }
wait(1);
}
}
I tried it with various combinations of mode flags and so forth, but never got it to detect hitting the 'red' cube... (yes I tried without using the LIGHT flag...) If you can spot whats wrong I would be grateful... Im suffering lots of mental 'blanks' lately... I know this USED to work... FYI Im using A7.86.0 commercial
"There is no fate but what WE make." - CEO Cyberdyne Systems Corp. A8.30.5 Commercial
|
|
|
Re: Is there a version of "in_solid" or "c_content" for meshes?
[Re: EvilSOB]
#351301
12/23/10 14:27
12/23/10 14:27
|
Joined: Sep 2003
Posts: 6,861 Kiel (Germany)
Superku
Senior Expert
|
Senior Expert
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
|
If the return parameter is negative, so the trace hits a polygon from behind and you stay in this model. I've liked and used this behaviour on prior versions, too, but it has been removed. As EvilSOB said, the trace simply passes through the polygon now.
"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual Check out my new game: Pogostuck: Rage With Your Friends
|
|
|
|