2 registered members (AndrewAMD, 7th_zorro),
1,285
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Fake AABB
[Re: 3run]
#422799
05/17/13 07:59
05/17/13 07:59
|
Joined: Aug 2002
Posts: 3,258 Mainz
oliver2s
Expert
|
Expert
Joined: Aug 2002
Posts: 3,258
Mainz
|
Sure, you are correct. Since AABB is not supported any more (but it still works) all c_ instructions in Acknex use ellipsoid shape. About the demo, unfortunately it does not provide a real AABB alternative, but just a fake one made out with ellipsoid shapes. Sorry for describing it wrong in my posts above.
Greets No, I've made some tests. c_move and c_rotate use a box shape, c_trace (with USE_BOX) uses really an ellipsoid shape.
|
|
|
Re: Fake AABB
[Re: oliver2s]
#422807
05/17/13 10:42
05/17/13 10:42
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
No, I've made some tests. c_move and c_rotate use a box shape, c_trace (with USE_BOX) uses really an ellipsoid shape. That is not possible.. Could you please upload a small example, which will show, that c_move and c_rotate are using box shapes? For a collision of a moving actor with an obstacle, the engine uses an Ellipsoid vs. Polygon collision detection. An ellipsoid is a distorted sphere that can emulate many collision shapes, such as cylinders, spheres or flat disks. Greets
|
|
|
Re: Fake AABB
[Re: 3run]
#422820
05/17/13 13:37
05/17/13 13:37
|
Joined: Aug 2002
Posts: 3,258 Mainz
oliver2s
Expert
|
Expert
Joined: Aug 2002
Posts: 3,258
Mainz
|
You already gave yourself the answer: in your posted table the manual says: And here my code example. Try to move the box with W,A,S,D and hit the other box. You will see the difference:
#include <acknex.h>
#include <default.c>
#define C_TRACE
//#define C_ROTATE
void main()
{
video_mode=9;
fps_max=60;
level_load("");
ENTITY* ent_tmp1=ent_create(CUBE_MDL,vector(30,0,0),NULL);
vec_set(ent_tmp1.scale_x,vector(8,4,0.5));
c_setminmax(ent_tmp1);
ENTITY* ent_tmp3=ent_create(CUBE_MDL,vector(0,30,50),NULL);
vec_set(ent_tmp3.scale_x,vector(4,2,1));
ent_tmp3.pan=90;
ent_tmp3.tilt=200;
c_setminmax(ent_tmp3);
camera.x=-250;
camera.z=25;
//c_trace method -> using ellipsoid
#ifdef C_TRACE
while(1)
{
VECTOR vec_tmp1,vec_tmp2;
vec_set(vec_tmp1,vector(0,(key_a-key_d)*time_step*2,(key_w-key_s)*time_step*2));
vec_set(vec_tmp2,ent_tmp3.x);
vec_add(vec_tmp2,vec_tmp1);
me=ent_tmp3;
result=c_trace(ent_tmp3.x,vec_tmp2,USE_BOX|IGNORE_ME);
if(result==0)
{
vec_add(ent_tmp3.x,vec_tmp1);
}
wait(1);
}
#endif
//c__rotate method -> using box method
#ifdef C_ROTATE
while(1)
{
var ent_tmp3_x_=ent_tmp3.y;
var ent_tmp3_z_=ent_tmp3.z;
ent_tmp3.y+=(key_a-key_d)*time_step*2;
ent_tmp3.z+=(key_w-key_s)*time_step*2;
result=c_rotate(ent_tmp3,vector(1,1,1),0);
if(result<=0)
{
ent_tmp3.y=ent_tmp3_x_;
ent_tmp3.z=ent_tmp3_z_;
}
else
{
vec_sub(ent_tmp3.pan,vector(1,1,1));
}
wait(1);
}
#endif
}
|
|
|
Re: Fake AABB
[Re: oliver2s]
#422827
05/17/13 15:20
05/17/13 15:20
|
Joined: May 2009
Posts: 5,370 Caucasus
3run
OP
Senior Expert
|
OP
Senior Expert
Joined: May 2009
Posts: 5,370
Caucasus
|
You already gave yourself the answer: in your posted table the manual says: Well, it's says that Box>Box used only for Model>Sprite collusions, or am I wrong? BTW, your code doesn't show, that c_rotate uses box shape. Rotate entity with it, and set GLIDE flag on, you'll see. And there is no way, for c_trace to have ellipsoid shape, but box for c_move and c_rotate, as they made of c_traces: Both c_move and c_rotate internally make use of c_trace by automatically setting USE_BOX and providing additional functionality such as gliding. If USE_BOX is not set, the c_trace collision will always use a ray. If the USE_BOX mode is set, c_trace tests an ellipsoid shape against polygonal targets. The collision shape used by c_move or c_rotate is either an oriented ellipsoid or an oriented box. Which one of these two is used depends on whether the collision is with a polygonal or a nonpolygonal target. Greets
|
|
|
Re: Fake AABB
[Re: 3run]
#422828
05/17/13 15:27
05/17/13 15:27
|
Joined: Aug 2002
Posts: 3,258 Mainz
oliver2s
Expert
|
Expert
Joined: Aug 2002
Posts: 3,258
Mainz
|
Well, it's says that Box>Box used only for Model>Sprite collusions, or am I wrong? BTW, your code doesn't show, that c_rotate uses box shape. Rotate entity with it, and set GLIDE flag on, you'll see. And there is no way, for c_trace to have ellipsoid shape, but box for c_move and c_rotate, as You mixing many things up. Box-Box means Model->Model OR Model-Sprite without POLYGON activated. And if you activate GLIDE the model doesn't even rotate, it also moves. And of course my example shows that c_rotate uses box shape. It rotates a box and gives results if a collision detection happend or not. If it would use an ellipsoid, it wouldn't recognize a collision on the edge corners of the box, but it does. Your quote of the manual that c_moves makes use of c_trace is right for sure. It says an ellipsoid is used for POLYGONAL entities. For BOX entities it uses still a box shape: The collision shape used by c_move or c_rotate is either an oriented ellipsoid or an oriented box. Which one of these two is used depends on whether the collision is with a polygonal or a nonpolygonal target.
Last edited by oliver2s; 05/17/13 15:38.
|
|
|
|