[Nice 2 Have] Collision - Slide wall
Page 1 of 1
[Nice 2 Have] Collision - Slide wall
I don't know how you want us to report you bugs or nice to have things ?
When you are "colliding" with a wall at less than 90degrees, you should slide alongs it.
The algo for this is easy (something like this) :
When you are "colliding" with a wall at less than 90degrees, you should slide alongs it.
The algo for this is easy (something like this) :
- Code:
position.X += velocity.X;
if(colliding())
position.X -= velocity.X;
position.Y += velocity.Y;
if(colliding())
position.Y -= velocity.Y;
position.Z += velocity.Z;
if(colliding())
position.Z -= velocity.Z
//colliding definition :
bool colliding()
{
int minX = Position.X - size.X / 2;
int minY = Position.Y - size.Y / 2;
int minZ = Position.Z - size.Z / 2;
int maxX = Position.X + size.X / 2;
int maxY = Position.Y + size.Y / 2;
int maxZ = Position.Z + size.Z / 2;
for (int x = minX; x <= maxX; x++)
for (int y = minY; y <= maxY; y++)
for (int z = minZ; z <= maxZ; z++)
{
if(blockType[x, y, z] != 0)
return true;
}
return false;
}
S33m3- Posts : 54
Join date : 2011-03-23
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|
Fri Jul 01, 2016 7:25 am by croxxx
» Source?
Thu Jul 12, 2012 9:55 am by raistlinthewiz
» Version Available (Take 2)
Sat Jun 09, 2012 3:23 am by kamild1996
» Terrain Rendering Bug
Thu May 17, 2012 8:07 am by sackboy789
» Mystery Block!
Thu Mar 29, 2012 4:42 am by Corvin73
» Your procedural tree/plant seeding technique?
Sat Mar 24, 2012 3:10 am by Slaihne
» Voxeliq project
Wed Mar 07, 2012 4:25 am by raistlinthewiz
» What is a Tech-Test?
Wed Jan 18, 2012 12:32 pm by joeydmars
» Images
Fri Jan 06, 2012 6:02 am by croxxx