jPCT - a 3d engine for Java > Support

how to put objects to x-axis



Now it's starting to go well with JPCT... ;)
How can I put objects with different heights on the x-axis so, that they all seems to be at the same level: ground. I made the ground with Primitives.getBox(50,0) and now I try to put two ASC-models with different "scales" and different heights on it so that there is no air under them. Do I have to use calcMinDistance  first to get the distance between origin and the object and then translate? Or is there an easier way to do it? Thanks alot!

I'm not totally sure what you are trying to the ground always flat? It is flat in the case you are describing (because it's a Box...why don't you use a Plane btw...?), but is this the normal case or just for testing? If your ground is not always flat, i think calcMinDistance() could be worth a try (remember to set collision modes accordingly). Another possibility would be to use a completely different data-structure to store the height of the ground at a specific position (a kind of heightmap). This could be faster than doing all on the polygonal level.
If the ground is always flat, there are two possibilities to get your objects "grounded". The first is: Try different values until is works... :wink:
The second is to obtain the dimensions of the object to do the translation accordingly. The problem is, that jPCT doesn't give you the object's dimensions. I can add this, if it would help (i.e. add the possibility to get the bounding box dimensions, which basically are the objects dimensions).


[0] Message Index

Go to full version