Fake AABB

Posted By: 3run

Fake AABB - 09/23/12 12:24

My first try to archive AABB collusions (I hate OBB). It's based on old C-Script of Mat-Allum a.k.a. Some Moron. I've implemented gravity and some other stuff, but it still has some bugs and it's very WIP. I hope someone will find this useful, and some of experienced users would try to help me with developing this farther, cause my knowledge isn't good enough.
Here is download link:
Download link
Controls:
WSAD - movement
CTRL - crawl
SPACE - jump
C - toggle camera modes
Posted By: Random

Re: Fake AABB - 09/23/12 16:47

What are you talking about? This is great!
I imported physX, to see if you can correctly interact with physic objects and it worked ^^
Crawling works fine (even thou the camera isn`t as deep as it should be).
This is very useful. I am working right now with it ^^
Posted By: Sajeth

Re: Fake AABB - 09/23/12 16:53

Being interested in the theory of stuff like this... why do you prefer AABB over OBB? Where's the advantages/disadvantages? laugh
Posted By: 3run

Re: Fake AABB - 09/24/12 14:14

Random@ I'm happy to see, that you've found it useful laugh

Sajeth@ I need box collusions (or at least capsule) instead of ellipsoid, I hate it.
I can't get solid movement with it, and I do not see any examples as well.
Posted By: 3run

Re: Fake AABB - 03/04/13 22:19

can anyone reupload this?
Posted By: Random

Re: Fake AABB - 03/05/13 06:29

Jop ^^

But a added granades for what reason ever...

Download link
Posted By: 3run

Re: Fake AABB - 03/05/13 09:20

Random@ thats ok, thank you.
Posted By: oliver2s

Re: Fake AABB - 05/16/13 17:49

Originally Posted By: 3run
I need box collusions (or at least capsule) instead of ellipsoid, I hate it.
I can't get solid movement with it, and I do not see any examples as well.

I've downloaded your script. Works fine for the FIRST sight. But in your script you use "USE_BOX" in "c_trace" to get collision detection.

The manual says USE_BOX don't use a box but an ellipsoid:
Quote:
USE_BOX
Uses the size, orientation, and shape of the bounding ellipsoid of the me entity as a 'probe' for tracing, rather than a line. The ellipsoid can be set up temporarily to the desired shape such as a sphere or a flat disk. A vertical trace with USE_BOX can detect the minimum ground distance within a round area, while ignoring small holes or grates.
Posted By: 3run

Re: Fake AABB - 05/17/13 00:34

Originally Posted By: oliver2s
The manual says USE_BOX don't use a box but an ellipsoid
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
Posted By: sivan

Re: Fake AABB - 05/17/13 06:49

maybe I asked it earlier: why don't you set simply your character to passable, and make a cube or cuboid entity at its origin set to polygon that is c_move-d and followed by the character? this way the character collision shape would be axis aligned.
Posted By: oliver2s

Re: Fake AABB - 05/17/13 07:59

Originally Posted By: 3run
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.
Posted By: 3run

Re: Fake AABB - 05/17/13 10:42

Originally Posted By: oliver2s
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?

Originally Posted By: Manual -> The Collision Engine


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
Posted By: oliver2s

Re: Fake AABB - 05/17/13 13:37

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:

Code:
#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
}





Posted By: 3run

Re: Fake AABB - 05/17/13 15:20

Originally Posted By: oliver2s
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? wink

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:
Originally Posted By: Manual -> The Collision Engine
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
Posted By: oliver2s

Re: Fake AABB - 05/17/13 15:27

Originally Posted By: 3run
Well, it's says that Box>Box used only for Model>Sprite collusions, or am I wrong? wink

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:
Originally Posted By: mighty manual
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.
Posted By: 3run

Re: Fake AABB - 05/17/13 18:06

Well I still didn't get it, but I won't argue with you, cause you are much more experienced than me laugh I would be greatfull, if you could upload an example, wich provides box shape and uses c_move with level blocks, cause I''ve never got it to work. With glide float set on.
Posted By: oliver2s

Re: Fake AABB - 05/17/13 18:40

If I get the manual right, on maps (level blocks?) only ellipsoid will be possible. I just overread that you want it on level blocks. My argues were for model blocks only. Sorry for the confusion.
Posted By: 3run

Re: Fake AABB - 05/17/13 19:40

Ahh, I got it now. Well, then solution with traces isn't that bad laugh
Posted By: JcI_the_second

Re: Fake AABB - 04/04/15 11:30

Link is broke. Can someone upload?

Thanks
Posted By: FBL

Re: Fake AABB - 04/04/15 11:38

You won't get the sources just by faking jcl.
Posted By: JcI_the_second

Re: Fake AABB - 04/04/15 11:43

Source is free if I am not wrong?

Firoball I'm just one of thousands jcl clones grin
Posted By: 3run

Re: Fake AABB - 04/05/15 15:00

Fake JCL, your fake AABB was reuploaded grin Check first post in this thread.

Best regards!
Posted By: JcI_the_second

Re: Fake AABB - 04/06/15 12:26

Thank you very much 3run. This code is perfect for start develop first person shooter.
© 2024 lite-C Forums