I need help performing ray picking on orthographically rendered planes. I'm able to both render and pick object in perspective mode, but I'm clueless when it comes to orthographically rendered objects.
The orthographical projection matrix is configured to have 0;0 at the top left, and width;height att the bottom right. Near plane is 0 and far is 100. The view matrix is simply an identity matrix:
Code: Select all
glm::mat4 orthoProjectionMatrix = glm::ortho(0.0f, (GLfloat)width, (GLfloat)height, 0.0f, 0.0f, 100.0f);
glm::mat4 orthoViewMatrix = glm::mat4(1.0f);
How do I set up a btCollisionShape to match my on-screen plane? I'm currently creating it like this, which is wrong:
Code: Select all
// Box, 100*100*0 (this is in NDC? Local space?)
collisionShape = new btBoxShape(btVector3(50.0f,50.0f,0.0f));
btQuaternion rot = btQuaternion::getIdentity();
btVector3 pos = btVector3(0,0,0);
btTransform trans = btTransform(rot, pos);
motionState = new btDefaultMotionState(trans);
btRigidBody::btRigidBodyConstructionInfo rigidBodyCI(0, motionState, collisionShape, btVector3(0,0,0));
rigidBody = new btRigidBody(rigidBodyCI);
And what do I pass to my btDiscreteDynamicsWorld.rayTest? My start and end vector right now are (x,y,0) respectively (x,y,-1000), should I transform them somehow?.