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.


Topics - tulsi

Pages: [1]
1
Support / Fitting an object inside the screen.
« on: August 20, 2020, 07:33:55 am »
Hello once again!!

In my app I will most probably have only one object on screen at a time. But that object may not be the same object every time like it can be a car, a chair, or something else like that.
Now the problem is those object may not have same size. But I want them to fit inside the screen.

I am able to get the realworld size of the object by using following function. Also I can get the screen resolution. But I dont know how to make relationship between them so that I can scale them accordingly.

Code: [Select]
public static SimpleVector getSize(Object3D object){
        float[] bbox = object.getMesh().getBoundingBox();
        Log.i("Util","getSize-bbox:"+bbox);
        float s = object.getScale();
        Log.i("Util","getSize-scale:"+object.getScale());
        Object3D[] par;
        par = object.getParents();
        while(par.length>0){
            s = s*par[0].getScale();
            Log.i("Util","getSize-parent:"+par[0].getScale());
            par = par[0].getParents();
        }
        SimpleVector out = new SimpleVector((bbox[1]-bbox[0])*s,(bbox[3]-bbox[2])*s,(bbox[5]-bbox[4])*s);
        Log.i("Util", "getSize:"+out.toString());
        return out;
    }

Thank you.. :)

2
Support / place an object to top part of the screen
« on: August 18, 2020, 07:39:24 am »
Hello,

I am new to JPCT, currently I am able to load .obj files and apply scale and rotation gesture.

Initially, when the object loads on the screen it appears at the center of screen. But I want it to be at top part of the screen.

Below is the picture of what I have now.



But I want as below.





Thanks. :) :)

Pages: [1]