move/rotate Mesh problem
Posted: Fri Oct 24, 2008 9:30 pm
Hi,
first I like to say that I really like the bepu engine and that the samples are a very big help ,
here my problem, I need to rotate a nonDynamic entity "ingame" that I want to use as part of a 3D menu. At the moment I use/modify code of the samples of the 0.6.2 version. First I wanted to use a rotation matrix but that didn't work, and now I had the idea to use the box.rotate function to rotate my entity with it.
My Code :
startSimulation(int sim):
Box entitybox = new Box(new Vector3(0, 0, 0), 1.5f, 1.5f, 1.5f);
entityRenderer.displayModels.Add(new DisplayModel(entity, entitybox));
space.add(entitybox);
at the Update method:
if (mouse is over entitybox and press left mouse button)
{
entitybox.rotate(new Vector3(0, 30, 0));
}
the problem is that if the raycast hits the entitybox, a error System.NullReferenceException occurs.
Now it would be great if somebody could give me a hint or a better solution to rotate my mesh/entity. Sorry for my rusty english, I hope my post is understandable.
first I like to say that I really like the bepu engine and that the samples are a very big help ,
here my problem, I need to rotate a nonDynamic entity "ingame" that I want to use as part of a 3D menu. At the moment I use/modify code of the samples of the 0.6.2 version. First I wanted to use a rotation matrix but that didn't work, and now I had the idea to use the box.rotate function to rotate my entity with it.
My Code :
startSimulation(int sim):
Box entitybox = new Box(new Vector3(0, 0, 0), 1.5f, 1.5f, 1.5f);
entityRenderer.displayModels.Add(new DisplayModel(entity, entitybox));
space.add(entitybox);
at the Update method:
if (mouse is over entitybox and press left mouse button)
{
entitybox.rotate(new Vector3(0, 30, 0));
}
the problem is that if the raycast hits the entitybox, a error System.NullReferenceException occurs.
Now it would be great if somebody could give me a hint or a better solution to rotate my mesh/entity. Sorry for my rusty english, I hope my post is understandable.