Παρασκευή 1 Οκτωβρίου 2021

Java3d Racer Building


https://www.rally-maps.com/database


31/10/21 brake ...final backup ...for .... programmers

(gamepads ready,roads ready)
unzip and run the dist/Jll.jar

https://drive.google.com/file/d/1bzZAWwnjh747V_rL6ISSuEpv4WEv4QQN/view?usp=sharing

Road/turning Settings closer to....

Richard Burns Rally- Rally Finland, SS Ouninpohja, Fiesta WRC 2017
https://www.youtube.com/watch?v=MzVFCH5HSWg




27/10/21

Finally Gamepads ready .All open src ready for netbeans 

Backup java3d 1_6 with jinput ready to execute (after unzip) dist/Jll.jar

https://drive.google.com/file/d/1cOTzjQJobj-ZTVhDcbAJSHstDQX84xRE/view?usp=sharing


















22/10/21







17/10/21










15/10/21


package jcolin;

import java.awt.BorderLayout;

import java.awt.Color;

import javax.swing.JFrame;

import javax.swing.JTextField;

public class CarDriverPhysicsCalculator {

    public static void main(String[] args) {

        CarDriverPhysicsCalculator test=new CarDriverPhysicsCalculator();

    }

    JFrame jfr=new JFrame("testing");

    JTextField jtf=new JTextField("Driver (++)Increasements per second here");

    static long counter=0,counterPrevius=0;

    //IF NOT STATIC then time / 5 

    //but if static then processor speed!!! SOS
 !!!!!!!!!!!!!!!!!!!!!!!!!!

    Thread refresher=new Thread(){

        public void run(){

            long c,dif;

            while(true){

                c=counter;

                dif=c-counterPrevius;

                counterPrevius=c;

                String text=dif+"  current : "+c;

                jtf.setText(text);

                System.out.println(""+text);

                try{

                    sleep(1000);

                }catch(InterruptedException inter){

                    jtf.setBackground(Color.red);

                }

            }

        }

    };

    void computePhysicsForStimulus(){

        ++counter;

    }

    boolean keep=true;

    Thread computer=new Thread(){

        public void run(){

            while(keep){//while(true){//true is Object and also gives /5 time

                computePhysicsForStimulus();

            }

        }

    };

    public CarDriverPhysicsCalculator(){

        jfr.setBounds(0,0,333,333);

        jfr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        jfr.getContentPane().add(jtf,BorderLayout.NORTH);

        jfr.setVisible(true);

        refresher.start();

        computer.start();

    }

}








////////////////////////////////////////////////////////////




    Trans wheelSteeringBasicEffectHolder=new Trans();

    double prevDegr;

    public void calculatePhysics(TEmulatorRider tem){

        if(tem.rpm>0){

            //vers00(tem);//ok

            //vers01(tem);//ok

            vers02(tem);

        }

        if(prevDegr!=tem.degr){

            wheelSteeringBasicEffectHolder.setIdentity();

            wheelSteeringBasicEffectHolder.mrz(Math.toRadians(-tem.degr));

            prevDegr=tem.degr;

            eff.tg.setTransform(wheelSteeringBasicEffectHolder);

        }

        //else{System.out.println("SAVED US !!!!!!!");}

    }

    void vers00(TEmulatorRider tem){

        tem.secondsRpmOfFrame=tem.seconds*tem.rpm;

        //this is the effect of wheels running (no actual moving on map)

        tem.aktiniaOfFrame=Rd.rad360*tem.secondsRpmOfFrame;

        ken.tg.mry(tem.aktiniaOfFrame);

        //  END FIRST VERSION check colorcube rotates 1(once) per minute for rpm=1       

    }

    void vers01(TEmulatorRider tem){

        vers00(tem);

        tem.applyingDefaultDistanceOfFrame=mper*tem.secondsRpmOfFrame;

        tg.mx(tem.applyingDefaultDistanceOfFrame);

        //  END SECOND VERSION check distance travel for 1 rotation per minute

    }

    void vers02(TEmulatorRider tem){

        tem.secondsRpmOfFrame=tem.seconds*tem.rpm;

        tem.aktiniaOfFrame=Rd.rad360*tem.secondsRpmOfFrame;

        ken.tg.mry(tem.aktiniaOfFrame);

        tem.applyingDefaultDistanceOfFrame=mper*tem.secondsRpmOfFrame;

            

            double dy=tem.applyingDefaultDistanceOfFrame*Math.sin(Math.toRadians(tem.degr));

            tg.mrz(-dy);

            double realDist=tem.applyingDefaultDistanceOfFrame*Math.cos(Math.toRadians(tem.degr));

            tg.mx(realDist);

    }

//////////////////////// 8 Oct


2 millis more for swing.JSpinner vs java3d 

    public static void main(String[] args) {

        JSpinner jsp=new JSpinner(new SpinnerNumberModel(15645,1,99999,100));

        Cylinder cyl=new Cylinder(654,5644);

        int i=0;

        int l=999999999;

        int val;

        long ts=System.currentTimeMillis();

        while(i<l){

            val=(int)jsp.getValue();

            //val=(int)cyl.getRadius();

            ++i;

        }

        long te=System.currentTimeMillis();

        long time=te-ts;

        System.out.println(time+" for "+l+" call iterations");

    }


Rear wheels may turn also !!!



Δεν υπάρχουν σχόλια: