• Create Account

### #ActualSaldan

Posted 22 March 2012 - 08:34 AM

I am not sure what "the problem" is at this stage. If you still haven't solved the issues with the volume of the object changing, you need to renormalize the quaternion periodically (for instance, after each step) by dividing it by its length. Does anything else seem broken?

Also, can you explain what you put in Rotation?

I checked to make sure it was normalizing, and I wasn't normalizing every frame, so I added that in. The result is that the size stays the same (thank you!), but the model only wobbles a bit along the Y and Z axes. To clarify: Holding down Left, which should make it rotate along the Y axis, instead makes it rotate a tiny bit to the left, then a tiny bit to the right, repeatedly, as though the ship were shaking its head.

Rotation around the X axis works fine, though.

Here is how I fill Rotation:

///Rotation
float TurnSpeed = 0.01;
sf::Vector3<float> Rotation;
Rotation.x = 0.0;
Rotation.y = 0.0;
Rotation.z = 0.0;
//Pitch
if (m_App->GetInput().IsKeyDown(sf::Key::Up) == true)
{
Rotation.x -= TurnSpeed;
}
if (m_App->GetInput().IsKeyDown(sf::Key::Down) == true)
{
Rotation.x += TurnSpeed;
}
//Yaw
if (m_App->GetInput().IsKeyDown(sf::Key::Left) == true)
{
Rotation.y -= TurnSpeed;
}
if (m_App->GetInput().IsKeyDown(sf::Key::Right) == true)
{
Rotation.y += TurnSpeed;
}
//Roll
if (m_App->GetInput().IsKeyDown(sf::Key::Q) == true)
{
Rotation.z -= TurnSpeed;
}
if (m_App->GetInput().IsKeyDown(sf::Key::E) == true)
{
Rotation.z += TurnSpeed;
}

### #1Saldan

Posted 22 March 2012 - 08:33 AM

I am not sure what "the problem" is at this stage. If you still haven't solved the issues with the volume of the object changing, you need to renormalize the quaternion periodically (for instance, after each step) by dividing it by its length. Does anything else seem broken?

Also, can you explain what you put in Rotation?

I checked to make sure it was normalizing, and I wasn't normalizing every frame, so I added that in. The result is that the size stays the same (thank you!), but the model only wobbles a bit along the Y and Z axes. Rotation around the X axis works fine.

Here is how I fill Rotation:

///Rotation
float TurnSpeed = 0.01;
sf::Vector3<float> Rotation;
Rotation.x = 0.0;
Rotation.y = 0.0;
Rotation.z = 0.0;
//Pitch
if (m_App->GetInput().IsKeyDown(sf::Key::Up) == true)
{
Rotation.x -= TurnSpeed;
}
if (m_App->GetInput().IsKeyDown(sf::Key::Down) == true)
{
Rotation.x += TurnSpeed;
}
//Yaw
if (m_App->GetInput().IsKeyDown(sf::Key::Left) == true)
{
Rotation.y -= TurnSpeed;
}
if (m_App->GetInput().IsKeyDown(sf::Key::Right) == true)
{
Rotation.y += TurnSpeed;
}
//Roll
if (m_App->GetInput().IsKeyDown(sf::Key::Q) == true)
{
Rotation.z -= TurnSpeed;
}
if (m_App->GetInput().IsKeyDown(sf::Key::E) == true)
{
Rotation.z += TurnSpeed;
}

PARTNERS