Aitorman

Members
  • Content count

    10
  • Joined

  • Last visited

Community Reputation

126 Neutral

About Aitorman

  • Rank
    Member
  1. Disable rotation of a body ODE

    Nevermind, I'm surprised that such a simple mistake has given me so much trouble haha. I didn't know that I could pass 0 as the joint group parameter jor dJointCreate to allocate the joint "normally" and I thought I had to pass a joint group, so I used the only one I have, the contact joint group, which is emptied each frame. That's why it did nothing.   But now I have another problem: I want the box to slide in a plane, and it does so correctly if the plane has no friction, but as soon as I put a bit of friction into it, the movement starts being a bit jerky, like it moves bit by bit at first and suddenly it gains speed and starts moving smoothly and very fast. Do you know how I can keep the smooth movement while constraining rotation?   P.S: Sorry if I make any grammar mistake, English is not my native language
  2. Hey there, I want to constraint the rotation of a cube so that it can only translate. I've tried using an aMotor with the following code: this->aMotor=dJointCreateAMotor(this->system->getGame()->worldID,this->system->jointGroup); dJointAttach(this->aMotor,0,this->bodyID); dJointSetAMotorMode(this->aMotor,dAMotorUser); dJointSetAMotorNumAxes(this->aMotor,3); dJointSetAMotorAxis(this->aMotor,0,0,1,0,0); dJointSetAMotorAxis(this->aMotor,1,0,0,1,0); dJointSetAMotorAxis(this->aMotor,2,0,0,0,1); dJointSetAMotorParam(this->aMotor, dParamVel1, 0); dJointSetAMotorParam(this->aMotor, dParamVel2, 0); dJointSetAMotorParam(this->aMotor, dParamVel3, 0); dJointSetAMotorParam(this->aMotor, dParamFMax1, dInfinity); dJointSetAMotorParam(this->aMotor, dParamFMax2, dInfinity); dJointSetAMotorParam(this->aMotor, dParamFMax3, dInfinity); If i'm not mistaken, that code creates an AMotor joint, attaches it to the body and the world, and sets the target velocity of each axis of the motor to be 0 and the FMax to be dInfinity. I thought that would disable the body's rotation, but it does nothing. Is there anything wrong with my code? Do you know any other way to constrain the rotation? Thanks in advance
  3. OpenGL Simple obj loader for OpenGl

    Thank you! Sorry for the late answer, I've been out in the weekend
  4. OpenGL Simple obj loader for OpenGl

    Thanks! I'll try using assimp or Dunge's solution If I can't get it to work.
  5. Hello there, I'm looking for a simple obj laoder for OpenGL, wich reads vertex,normal, index and uv data. Everything I've seen is either too simple (doesn't have support for index data), or too complex (assimp, for example). Doesn anyone know of a simple obj loader wich gets index data?
  6. Help with lookAt camera

    Yeah, I've tried that, but the object's rotation only works for the camera if the offset is for example (0,0,5), but if it is (0,5,5), it doesn't work because It has to point 45 degrees for on the x axis than the object. Anyways, I have changed to another camera system. When you specify the offset vector, you also have to specify an offset rotation quaternion, and the camera's rotation will be the object's rotation multiplied by the offset rotation. So, if you have this offset vector (0,5,5), the offset rotation will have to rotate the object 45 degrees along the x axis to have the camera pointing to the object always
  7. Help with lookAt camera

    Hello there. I'm trying to make a camera in OpenGL wich follows an object, and i have implemented it like this: The camera stores a vector wich represent an "offset" from the object to the camera. For example, if that vector is (0,0,-5), the camera will be 5 units behind the object. Then I assign the object's rot to the camera's rot (all rotations are in quaternions), then I rotate the offset vector with the object's rotation, and I add the rotated offset to the camera's pos. That works fine for the camera position relative to the object. For the rotation, I use a lookAt function that takes the origin as the camera's pos, and the inverse of the rotated offset vector as the target object. This works fine too, except for one little problem: when the camera is almost exactly below (or above) the object, but a little to the left, it is like this: [img]http://i.imgur.com/BCPs6.png[/img] and when it's also almost below, but a bit to the right, I want it to behave like this: [img]http://i.imgur.com/rnn19.png[/img] But instead, i get this: [img]http://i.imgur.com/ECiQP.png[/img] And I can't solve this problem, I've thought of adding 180 degrees of rotation in the cameras look vector when it's needed (in the second case), but that generates a problem In other situtations, when the object is rotated in a way that requires the camera to behave in the third image's way. What solution do you think is better to solve this problem?
  8. Thank you! My way of thinking seems silly now that I understand what it really does, corrected!
  9. Hello there! In my game I have a vec3 that points from the camera to an object i want the camera to follow, so I use this to get the camera's orientation quaternion: this->cameraRot=glm::angleAxis(0.0f,vector); If i understand that function correctly, when passing a vector (0.0f,0.0f,-1.0f) for example, it should create a quaternion that orientates the camera to point directly into the depth of the screen with no roll, and for example, with a vector (1.0f,0.0f,0.0f), it should orientate the camera to the right, with no roll too. But i don't know why, that function only creates a quaternion different from the identity quaternion if I pass a value different from 0 to the angle. Why does this happen? Thanks in advance, Aitor
  10. Hello everyone, I'm trying to use GLFW in mac osx. I have already built the project (using "make cocoa" on the terminal), which generates libglfw.a, libglfw.dylib, and libglfw.pc.in. In my Xcode project I've added the Cocoa and OpenGL frameworks (in Build Phases/Link binary with libraries), and the libglfw.a static library. If i'm not mistaken (I'm new to this so I probably am), this should be enough to statically link against GLFW, and I should not need the dynamic library, but when I try to run the program, it says that libglfw.dylib could not be found. My question is, ¿why do i need the dynamic library If i am linking against GLFW statically?