Jump to content

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Why doesn't my object collision work?

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
No replies to this topic

#1 theo2005   Members   

114
Like
0Likes
Like

Posted 27 June 2012 - 03:53 PM

Here's the code to show what I'm doing:

static float (* FrontX)[4] = new float[ObjectQuantity][4];
static float (* FrontY)[4] = new float[ObjectQuantity][4];
static float (* FrontZ)[4] = new float[ObjectQuantity][4];
	static float (* BackX)[4] = new float[ObjectQuantity][4];
static float (* BackY)[4] = new float[ObjectQuantity][4];
static float (* BackZ)[4] = new float[ObjectQuantity][4];
for (int count = 0; count < 4; ++ count)
{
  FrontX[ObjNum][count] = front[count].x;
  FrontY[ObjNum][count] = front[count].y;
  FrontZ[ObjNum][count] = front[count].z;
  BackX[ObjNum][count] = back[count].x;
  BackY[ObjNum][count] = back[count].y;
  BackZ[ObjNum][count] = back[count].z;
}
for (int count = 1; count < ObjectQuantity; ++ count) //count 1+ because 0 is player, other objects wont collide
	 {
		for (int CountCorner = 0; CountCorner < 4; ++ CountCorner)
	 {
			if (FrontX[0][CountCorner] == FrontX[count][CountCorner])
	  {
	   Movement = FALSE;
	  }
	 }
	 }

I'm only checking the Front X corners of every object, just to check if they collide, but movement never turns false. If I change the == operand to bigger or smaller, then movement becomes false... HOW?? What exactly am I doing wrong here? I tried bashing my player into a wall walking straight, backwards, turning, whatever..


Nevermind! I figured it out myself. Even though now bound drawing system is bugged somewhat, but oh well...

Edited by theo2005, 28 June 2012 - 03:41 AM.





Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.