Show Posts

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.


Messages - theFALCO

Pages: 1 2 [3]
31
Support / rotation problem (it moves)
« on: December 14, 2006, 07:43:11 pm »
this is the starting position:

this shows that from this orientation the up/down rotation is good:

but when I turn left (the ball is one of those four balls which I added for better orientation):

the up/down rotation looks like this:


32
Support / rotation problem (it moves)
« on: December 13, 2006, 08:29:12 pm »
nope, still have problems  :(

33
Support / rotation problem (it moves)
« on: December 13, 2006, 03:57:24 pm »
oh, yes I see it in the FPS example
Code: [Select]
     if (left) {
         camera.rotateAxis(camera.getBack().getYAxis(), -TURN_SPEED);
         playerDirection.rotateY(-TURN_SPEED);
      }
      if (right) {
         camera.rotateAxis(camera.getBack().getYAxis(), TURN_SPEED);
         playerDirection.rotateY(TURN_SPEED);
      }

I'll try it

34
Projects / FutureRP - 2D Isometric Engine with 3D characters
« on: December 12, 2006, 09:51:19 pm »
beloved oldie Little Big Adventure :') *sniff*
looks the same... even the player model

35
Support / rotation problem (it moves)
« on: December 12, 2006, 09:48:32 pm »
i have created 4 balls: up, down, left and right to visualize it better

what i see is that it seems like it's rotating around the same unchangable axis... what I mean is when the cube rotates, the pivot, axis or whatever it is, doesn't (the cube rotates using some global axis, not it's local) so when it becomes "from the left side" it is rotated as thought it's side was the front... or like so

maybe I forgot something like: cube.recalculateThePivotAndOtherRotationStuffSoThatYouDontHaveProblemsRotatingThisCubeThatYouWasSoHappyAbout();

36
Support / rotation problem (it moves)
« on: December 12, 2006, 08:53:04 pm »
yes but then it rotates very strange... from the begining while rotating up/down it behaves as it shoul - it changes it's pitch, when i turn it 90 deg to the right/left then up/down makes it to roll (become like up side down)

37
Support / rotation problem (it moves)
« on: December 12, 2006, 08:24:21 pm »
I'm rotating my cube like so:
Code: [Select]
               if(right) {
                    cube.rotateY(0.01f);
                    cube.translate(cube.getYAxis());
                }


when I rotate it, it moves down (while rotating), and when I rotate it the similar way with the X axis it moves right (while rotating).

any idea why it acts like that and how to fix it?

38
Support / [noob] my first try
« on: December 11, 2006, 08:27:08 pm »
okay, I found it, it was a silly one:
Code: [Select]
buffer.display(gFrame, height, width);
is wrong
Code: [Select]
buffer.display(gFrame, leftBorderWidth, titleBarHeight);
is correct
 :oops:
sorry for spam

39
Support / [noob] my first try
« on: December 10, 2006, 06:19:03 pm »
It's my first try with this (well exactly ANY) engine and I just can't get it to work
here's the code (sorry for making another thread with "correct my code, please", I just really can't find the critial thing that makes stuff not working):
Code: [Select]
import java.io.*;

import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;

import com.threed.jpct.*;
import com.threed.jpct.util.*;

class Cube {

    private final static int SWITCH_RENDERER=35;
    private boolean fullscreen=false;
    private boolean openGL=true;
    private boolean wireframe=false;

    private FrameBuffer buffer=null;
    private World theWorld=null;
    private TextureManager texMan=null;
    private Camera camera=null;

    private int width=640;
    private int height=480;

    private Frame frame=null;
    private Graphics gFrame=null;
    private BufferStrategy bufferStrategy=null;
    private GraphicsDevice device=null;
    private int titleBarHeight=0;
    private int leftBorderWidth=0;

    private int switchMode=0;

    private int fps;
    private int lastFps;
    private long totalFps;

    private int pps;
    private int lastPps;

    private boolean isIdle=false;
    private boolean exit=false;

    private boolean left=false;
    private boolean right=false;
    private boolean forward=false;
    private boolean back=false;
    private boolean fire=false;
    private int fireCount=3;

    private float speed=0;

    private KeyMapper keyMapper=null;

    private Cube(String[] args) {
        Config.glFullscreen=false;
        Config.glMipmap=true;
        Config.glColorDepth=16;
        Config.maxPolysVisible=10000;
        isIdle=false;
        switchMode=0;
        totalFps=0;
        fps=0;
        lastFps=0;
        theWorld=new World();
        texMan=TextureManager.getInstance();
        Config.fadeoutLight=false;
        theWorld.getLights().setOverbrightLighting(Lights.OVERBRIGHT_LIGHTING_DISABLED);
        theWorld.getLights().setRGBScale(Lights.RGB_SCALE_2X);
        theWorld.setAmbientLight(25, 30, 30);
        theWorld.addLight(new SimpleVector(0, -150, 0), 25, 22, 19);
        theWorld.addLight(new SimpleVector(-1000, -150, 1000), 22, 5, 4);
        theWorld.addLight(new SimpleVector(1000, -150, -1000), 4, 2, 22);
        theWorld.setFogging(World.FOGGING_ENABLED);
        theWorld.setFogParameters(1200, 0, 0, 0);
        Config.farPlane=1200;
        Object3D cube = Primitives.getBox(10, 1);
        cube.setOrigin(new SimpleVector(0, 0, 0));
        char c=File.separatorChar;
        texMan.addTexture("tekstura", new Texture("textures"+c+"ql0.jpg"));
        cube.setTexture("tekstura");
        cube.setTranslationMatrix(new Matrix());
        theWorld.addObject(cube);
        camera=theWorld.getCamera();
        camera.setPosition(0, 0, -180);
        camera.lookAt(cube.getTransformedCenter());

        theWorld.buildAllObjects();
        Config.tuneForOutdoor();
        initializeFrame();
        gameLoop();
    }

    public static void main(String[] args) {
        new Cube(args);
    }

    private void initializeFrame() {
        if (fullscreen) {
            GraphicsEnvironment env=GraphicsEnvironment.getLocalGraphicsEnvironment();
            device=env.getDefaultScreenDevice();
            GraphicsConfiguration gc=device.getDefaultConfiguration();
            frame=new Frame(gc);
            frame.setUndecorated(true);
            frame.setIgnoreRepaint(true);
            device.setFullScreenWindow(frame);
            if (device.isDisplayChangeSupported()) {
                device.setDisplayMode(new DisplayMode(width, height, 32, 0));
            }
            frame.createBufferStrategy(2);
            bufferStrategy=frame.getBufferStrategy();
            Graphics g=bufferStrategy.getDrawGraphics();
            bufferStrategy.show();
            g.dispose();
        } else {
            frame=new Frame("jPCT "+Config.getVersion());
            frame.pack();
            Insets insets = frame.getInsets();
            titleBarHeight=insets.top;
            leftBorderWidth=insets.left;
            frame.setSize(width+leftBorderWidth+insets.right, height+titleBarHeight+insets.bottom);
            frame.setResizable(false);
            frame.show();
            gFrame=frame.getGraphics();
        }
        frame.addWindowListener(new WindowEvents());
        keyMapper=new KeyMapper(frame);
    }

    private void gameLoop() {
        World.setDefaultThread(Thread.currentThread());
        buffer=new FrameBuffer(width, height, FrameBuffer.SAMPLINGMODE_NORMAL);
        buffer.enableRenderer(IRenderer.RENDERER_SOFTWARE);
        buffer.setBoundingBoxMode(FrameBuffer.BOUNDINGBOX_NOT_USED);
        buffer.optimizeBufferAccess();

        Timer timer = new Timer(25);
        timer.start();

        while(!exit) {
            if(!isIdle) {
                buffer.clear();
                theWorld.renderScene(buffer);
                theWorld.draw(buffer);
                buffer.update();
                buffer.display(gFrame, height, width);
                Thread.yield();
            }
        }
        if (openGL) {
            buffer.disableRenderer(IRenderer.RENDERER_OPENGL);
        } else {
            if (fullscreen) {
                device.setFullScreenWindow(null);
            }
        }
        System.exit(0);
    }

    private class WindowEvents extends WindowAdapter {
        public void windowIconified(WindowEvent e) {
            isIdle=true;
        }

        public void windowDeiconified(WindowEvent e) {
            isIdle=false;
        }
    }

    private class Timer {

        private long ticks=0;
        private long granularity=0;

        public Timer(int granularity) {
            this.granularity=granularity;
        }

        public void start() {
            ticks=System.currentTimeMillis();
        }

        public void reset() {
            start();
        }

        public long getElapsedTicks() {
            long cur=System.currentTimeMillis();
            long l=cur-ticks;

            if (l>=granularity) {
                ticks=cur-(l%granularity);
                return l/granularity;
            }
            return 0;
        }
    }

}


all I see is a white window with no box

Pages: 1 2 [3]