Im using the raycasting code from the wiki, however I keep getting the error;
what am i doing wrong, I copied this code from the wiki, assuming it was right, or am I using a old version of box2d without raycasting, or has it been deprecated. I looked through the source code for box2d I have and it wasn't there, which was a little confusing.
any help would be very gratefully accepted.
here is the code I am using;
Code:
'RaycastOne' : is not a member of 'b2World'
what am i doing wrong, I copied this code from the wiki, assuming it was right, or am I using a old version of box2d without raycasting, or has it been deprecated. I looked through the source code for box2d I have and it wasn't there, which was a little confusing.
any help would be very gratefully accepted.
here is the code I am using;
Code:
//raycast
b2Segment segment;
b2Vec2 start(5.0f,0.0f);
b2Vec2 direction(1.0f,0.0f);
//Set to world width + world height to be sure of infinite ray
float32 maxLength = 10000;
segment.p1 = start;
segment.p2 = start + maxLength * direction;
float32 lambda=1;
b2Vec2 normal;
b2Shape* shape = myWorld->RaycastOne(segment,&lambda,&normal,false,NULL);
if(shape){
b2Vec2 collisionPoint = (1 - lambda) * segment.p1 + lambda * segment.p2;
// Do something...
glBegin(GL_LINES);
glVertex2f(start.x,start.y);
glVertex2f(collisionPoint.x,collisionPoint.y);
glEnd();
}else{
glBegin(GL_LINES);
glVertex2f(start.x,start.y);
glVertex2f(segment.p2.x,segment.p2.y);
glEnd();
}
b2Segment segment;
b2Vec2 start(5.0f,0.0f);
b2Vec2 direction(1.0f,0.0f);
//Set to world width + world height to be sure of infinite ray
float32 maxLength = 10000;
segment.p1 = start;
segment.p2 = start + maxLength * direction;
float32 lambda=1;
b2Vec2 normal;
b2Shape* shape = myWorld->RaycastOne(segment,&lambda,&normal,false,NULL);
if(shape){
b2Vec2 collisionPoint = (1 - lambda) * segment.p1 + lambda * segment.p2;
// Do something...
glBegin(GL_LINES);
glVertex2f(start.x,start.y);
glVertex2f(collisionPoint.x,collisionPoint.y);
glEnd();
}else{
glBegin(GL_LINES);
glVertex2f(start.x,start.y);
glVertex2f(segment.p2.x,segment.p2.y);
glEnd();
}