it works, thank you!
PS: sorry for the late response, short break from work the last week
PS: sorry for the late response, short break from work the last week
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menupublic float calcMinDistance(SimpleVector paramSimpleVector1, SimpleVector paramSimpleVector2, float paramFloat)
{
Object3D localObject3D = null;
float f1 = 3.4028235E+38F;
for (int i = 2; i < this.objectList.size(); ++i)
{
localObject3D = this.objectList.elementAt(i);
if ((!(localObject3D.isPotentialCollider)) || ((!(localObject3D.isMainWorld)) && (localObject3D.oneSectorOnly) && (Config.useFastCollisionDetection) && (localObject3D.hasBoundingBox) && (localObject3D.rayIntersectsAABB(paramSimpleVector1, paramSimpleVector2, true) >= paramFloat)))
continue;
float f2 = localObject3D.calcMinDistance(paramSimpleVector1, paramSimpleVector2, paramFloat);
if (f2 >= f1)
continue;
f1 = f2; <- save object
} if (f1 != 3.4028235E+38F)
return f1; <- return array of object and distance
return 1.0E+012F;
}
//naar 3d coordinaten
SimpleVector position = new SimpleVector(Interact2D.reproject2D3D(
camera, buffer, x, y));
//naar world space coordinaten
position.matMul(camera.getBack().invert3x3());
position.add(camera.getPosition());
SimpleVector direction = position.calcSub(camera.getPosition()).normalize();
float distance = world.calcMinDistance(position, direction, 10000);
SimpleVector collisionPoint = new SimpleVector(direction);
collisionPoint.scalarMul(distance);
collisionPoint.add(position);
if ((e.getModifiers() & InputEvent.BUTTON1_MASK) == InputEvent.BUTTON1_MASK)
{
if(distance != Object3D.COLLISION_NONE)
{
position = new SimpleVector(Interact2D.reproject2D3D(
camera, buffer, x, y));
int[] is = Interact2D.pickPolygon(world.getVisibilityList(), position, Interact2D.EXCLUDE_NOT_SELECTABLE);
int t = Interact2D.getObjectID(is);
@Override
public void startPainting()
{
if (GLContext.getCapabilities().GL_ARB_multisample)
{
System.out.println("Reinit for multisample");
buffer.dispose();
// create a new buffer to draw on:
buffer = new FrameBuffer(RENDERWIDTH, RENDERHEIGHT, FrameBuffer.SAMPLINGMODE_GL_AA_4X);
buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
buffer.disableRenderer(IRenderer.RENDERER_OPENGL);
rendercanvas = buffer.enableGLCanvasRenderer();
rendercanvas.setBackground(new Color(34,34,34));
rendercanvas.setSize(RENDERWIDTH, RENDERHEIGHT);
}
buffer.setPaintListener(null);
new Thread(this).start();
}
Page created in 0.050 seconds with 12 queries.