• 2D
  • 3D collisions boxes in 2D

Hello, Is there a way to use the 3D collisions boxes in a 2Dnode character. By adding a simple -Negative and +positive value to the collision z_index ? Iam trying a 2.5D game ( i think this is what its called ? ) And its relatively easy to do.

all it takes its this: if ( is_on_floor() ): z_index = position.y;

The attack collisions its were it gets dificult, i wouldnt like to code a collision system from scratch...lol

I'm not sure you can combine 2D and 3D objects on the same node (maybe you can, I haven't tried it). But an easy solution would just be to save the z depth of the collision box and do the collisions as normal 2D. Then if there is an overlap in 2D, check that the z_index is within the colliding body's z_index (plus and minus the z depth value). I think that should work.

@cybereality said: I'm not sure you can combine 2D and 3D objects on the same node (maybe you can, I haven't tried it).

It can done but the 2d scene changes to the 3d scene, and adding a 2dsprite to the collision 3D doesnt update the sprite x,y,z, iam not sure its working, but maybe it can done, by changing the 3d box coords in the script, i dont have visibility in the editor.

@cybereality said: check that the z_index is within the colliding body's z_index (plus and minus the z depth value). I think that should work.

That was the solution i also though of... But they will collide 1st and then check for the collision, i was trying to avoid that..lol

Can you explain more about how your game works? Is it 2D or 3D?

Ive have a small template both in 2D and 3D. In the 3d mode the camera its changed to x -45 rotation and sprites are also x -45... The problem here is when the player jumps .

match state:
	"st_idle":
		YZ_relative = translation.z;
		_stop();
		_move();
		_attack();
		$playerAnim.play("idle");
	
	"st_walk":
		YZ_relative = translation.z;
		_move();
		_attack();
		$playerAnim.play("walk");
	
	"st_jump": #--------jumping-------
		_jumpMove();
		motion.z = motion.y*-1 ;
		if ( is_on_floor() ):
			motion.z = YZ_relative;
			state = "st_idle";

when he lands on the floor the z movement ( translation.z ) keeps increasing 0.00001 sometimes 0.005 making him move down about 5 pixels.

Iam using this same template on the video:

I still havent tested the hitboxes or making a floor, but the 2D seems to me like a more easy way to go. Iam having problems with the 3Dphysics for some reason my move and snap only works with the move speed above 3.