public override void render(float elapsedTime) { Device d3dDevice = GuiController.Instance.D3dDevice; //Obtener rotacion de mesh (pasar a radianes) float rotation = FastMath.ToRad((float)GuiController.Instance.Modifiers["rotation"]); //Rotar mesh y rotar OBB. A diferencia del AABB, nosotros tenemos que mantener el OBB actualizado segun cada movimiento del mesh Vector3 lastRot = mesh.Rotation; float rotationDiff = rotation - lastRot.Y; mesh.rotateY(rotationDiff); obb.rotate(new Vector3(0, rotationDiff, 0)); //Actualizar posicion Vector3 position = (Vector3)GuiController.Instance.Modifiers["position"]; Vector3 lastPos = mesh.Position; Vector3 posDiff = position - lastPos; mesh.move(posDiff); obb.move(posDiff); //Renderizar modelo mesh.render(); //Renderizar obb obb.render(); }
public override void Render() { PreRender(); //Obtener rotacion de mesh (pasar a radianes) var rotation = FastMath.ToRad((float)Modifiers["rotation"]); //Rotar mesh y rotar OBB. A diferencia del AABB, nosotros tenemos que mantener el OBB actualizado segun cada movimiento del mesh var lastRot = mesh.Rotation; var rotationDiff = rotation - lastRot.Y; mesh.rotateY(rotationDiff); obb.rotate(new Vector3(0, rotationDiff, 0)); //Actualizar posicion var position = (Vector3)Modifiers["position"]; var lastPos = mesh.Position; var posDiff = position - lastPos; mesh.move(posDiff); obb.move(posDiff); //Renderizar modelo mesh.render(); //Renderizar obb obb.render(); PostRender(); }