Not sure how you have this implemented, can you post any code?
Assuming your using either, RotateX or RotateY or RotateAxix just provide accessors to them where defined.
For instance:
private float m_rotateX = 0.0f;
public float GetRotateX
{
Get
{
return m_rotateX;
}
Set
{
m_rotateX = value;
}
}
In your render method:
m_matrix = new Matrix();
m_matrix = Matrix.Identity;
m_matrix.RotateX = GetRotateX;
Then in your keyboard handler... again not sure how this is setup.
public void Keydown(Micorosft.DirectX.DirectInput.Device m_keyboardDevice)
{
foreach (Key k in m_keyboardDevice.GetPressedKeys())
{
if (k == Key.UpArrow)
{
GetRotateX = GetRotateX += 0.01f;
}
}
}
Oh yea sorry, this code is in C# not sure what language your using?
ok, i will explain clearer, and yes im using c#
using directx meshs i have a sphere, which is 1st placed at the origin (0,0,0)
i also have a texture which is applied to the mesh
when i press up i want the sphere to spin, not move, just spin in a forward direction
currently, i read the keyboad like so:
private void ReadUserInput(){
di.KeyboardState keys = keyb.GetCurrentKeyboardState();if (keys[di.Key.Up]){
}
and i render the ball like so:
dev.SetTexture(0, ball.Texture);
dev.Transform.World =
Matrix.Translation(new Vector3(ball.X, ball.Y, ball.Z));ball.Mesh.DrawSubset(0);
now i applied the code u gave above, but it made the ball move round in a circle, not just spin round.
can u help me now ![]()
Hello again,
Seeing what you want to do, you should be able to accomplish the output your looking for using either:
dev.Transform.World = Matrix.RotationZ(your variable to rotate here);
or
dev.Transform.World = Matrix.RotationY(variable to rotate);
There are a couple other's in there that use rotation.
Please let me know if this gets your closer to what your trying to do or not.