Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Aitorman

Member Since 18 Mar 2012
Offline Last Active Apr 07 2013 03:35 AM

Topics I've Started

Disable rotation of a body ODE

23 March 2013 - 11:06 AM

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


Simple obj loader for OpenGl

20 September 2012 - 01:56 PM

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?

Help with lookAt camera

17 September 2012 - 12:23 PM

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:
Posted Image

and when it's also almost below, but a bit to the right, I want it to behave like this:
Posted Image

But instead, i get this:
Posted Image

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?

glm's angleAxis function creates identity quaternion if angle 0 is passed

15 September 2012 - 03:07 AM

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

Why do i need to use libglfw.dylib if I am statically linking against GLFW?

27 July 2012 - 07:08 AM

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?

PARTNERS