
I want to move a 3D Box,but not found the method continuously.Please give advice or comments,thanks!



There are lots of ways to move a box with Balder. Depending on what you are trying to do. A first good step would be checking out the samples that come with the source. Or you could view the sample browser (from the front page).
If you want finer control over how the movement works you could setup something like a game loop. There is a Game object in balder that has an update event. You can use that as the bases for your game loop. Just record the time the last event took
place, and then on later updates subtract that time from the current time. That will give you the elapsed time.
From there you can set the position of the 3d box so that it moves at a consistent speed. I’d be happy to get an example for you if you’d like wllwlqe. Just let me know.



Thanks a lot! but maybe I related uncleanly,I want to move a 3D Box with mouse,the method I used as follows:
private void Box_MouseMove(object sender, Balder.Input.MouseEventArgs args)
{
if (mouseDown)
{
X = args.GetPosition(game).X;
Y = args.GetPosition(game).Y;
deltaX = X  point.X;
deltaY = Y  point.Y;
Balder.Math.Matrix matrix = new Balder.Math.Matrix();
float moveFactor = 0.01f;
CamTarget.X += (float)(moveFactor * (deltaX * matrix.M11  deltaY * matrix.M12));
CamTarget.Y += (float)(moveFactor * (deltaX * matrix.M21  deltaY * matrix.M22));
CamTarget.Z += (float)(moveFactor * (deltaX * matrix.M31  deltaY * matrix.M32));
CamPostion.X += (float)(moveFactor * (deltaX * matrix.M11  deltaY * matrix.M12));
CamPostion.Y += (float)(moveFactor * (deltaX * matrix.M21  deltaY * matrix.M22));
CamPostion.Z += (float)(moveFactor * (deltaX * matrix.M31  deltaY * matrix.M32));
matrix = Balder.Math.Matrix.CreateLookAt(CamPostion, CamTarget, new Vector(0, 1, 0));
game.Camera.ViewMatrix.Equals(matrix);
}
}
but this method never worked,Please give advice or comments,Thanks very much!


Coordinator
Dec 21, 2010 at 8:03 PM

That method looks like you're trying to manipulate the camera and not move the object. If you're looking at just rotating the object with the mouse, you can turn on a flag that is called InteractionEnabled, just set it to true and you'll be able to rotate
the object.
Instead of the MouseMove thing, there are a few other events that might be interesting; ManipulationStarted, ManipulationStopped and ManipulationDelta.



adept wrote:
That method looks like you're trying to manipulate the camera and not move the object. If you're looking at just rotating the object with the mouse, you can turn on a flag that is called InteractionEnabled, just set it to true and you'll be able to rotate
the object.
Instead of the MouseMove thing, there are a few other events that might be interesting; ManipulationStarted, ManipulationStopped and ManipulationDelta.
Thanks a lot! But I'm looking at moving the object with the mouse, not rotating. CamTarget on example quoted above is object's position, CamPostion on example quoted above is camera's position. I used the same method on C#, the method worked, but here
never worked.
And I discovered a problem. I used the silder to rotate the object, the object revolved around the Y axis naturally, but when the object revolved around the X axis more than 180°abnormally.

