我用C ++几次使用Box2D,但第一次看到这样的事情。 我创建了两个对象,相同的宽度和高度为25像素。第一个初始位置是[25,25],第二个是[25,75]当我第一次移动时,碰撞开始于[25,25]。此外,当第一个对象从[25,200]开始并向下移动时,碰撞开始于[25,125]。看起来固定装置应该更大。
这是Box2D重新发布的部分代码:
return false
有什么想法吗?
编辑:
好的,我找到了DebugDraw的SDL版本。它看起来像那样
int account, minutes1, minutes2;
char s;
float cost;
printf("Please enter your account number. \n");
scanf_s("%d" , &account);
if(account == -1)
return 0;
printf("Please enter your service code(r for regular or p for premium). \n"); /*checking service*/
scanf_s(" %s" , &s);
switch(s)
{ /*execute specific parameters when r or p are selected as service codes.*/
case 'a':
case 'b':
case 'c':
case 'd':
case 'e':
case 'f':
case 'g':
case 'h':
case 'i':
case 'j':
case 'k':
case 'l':
case 'm':
case 'n':
case 'o': printf("Error. Please choose a correct service code (r for regular or p for premium). \n");
break;
case 'p': printf("Please enter how many minutes you've used between 6am and 6pm. \n");
scanf_s("%d" , &minutes1);
if(minutes1 > 75)
minutes1 = (minutes1-75)*.10;
printf("Please enter how many minutes you've used between 7pm and 5am. \n");
scanf_s("%d" , &minutes2);
if(minutes2 > 100)
minutes2 = (minutes2-100)*.05;
cost = 25+minutes1+minutes2;
printf("Your account number is %d, your service code is premium, you used %d minutes during the day and %d minutes during the night and your bill comes to $%lf. \n", account, minutes1, minutes2, cost);
break;
case 'q':
case 'r': printf("Please enter how many minutes you've used. \n");
scanf_s("%d", &minutes1);
if(minutes1 > 55)
minutes1 = (minutes1-55)*.20;
cost = 10+minutes1;
printf("Your account number is %d, your service code is regular, you used %d minutes and your bill comes to %lf. \n");
break;
case 's':
case 't':
case 'u':
case 'v':
case 'w':
case 'x':
case 'y':
case 'z': printf("Error. Please choose a correct service code (r for regular or p for premium). \n");
break;
}`
但它不起作用,因为h总是等于0.它确实等于0,因为顶点[0] .y总是等于顶点[1] .y。 顶点值也不正确。对象的位置是[50,25],但顶点x和y等于[25,0]。
有什么想法吗?