Main Menu
Menu

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.

Show posts Menu

Messages - Kaiidyn

#61
Support / Re: Rotate camera around point
February 12, 2011, 09:11:37 PM
I'm probably being stupid, but I don't get it...  ???
#62
Support / Rotate camera around point
February 12, 2011, 04:21:26 PM
How do I rotate my camera around the player when moving my finger over the screen? (on all axis)
what I currently have is this
camPos.x = (float) (Math.sin(me.getX()%360 * (Math.PI/180)) * -1.5f);
camPos.z = (float) (Math.cos(me.getX() * (Math.PI/180)) * 2.25f);


but this does not take the player position into account.. and is probably plain bad maths =p (i suck at them lols)

Kind regards,
Kaiidyn.
#63
Support / Re: Picking Objects (Pegando Objetos)
February 10, 2011, 10:05:09 PM
getY() - 24 might help. 24 is about the default height for a title bar, taskbar etc etc.
#64
Support / Re: help with converting 3ds model
February 09, 2011, 10:25:41 PM
android does not work with c:/ or anything...
you need to use the sdk resources.
#65
Support / Re: Polygon picking?
February 09, 2011, 06:52:38 PM
Ok, got something working, however i get coordinates like
x: -0.18257418
y: -0.91287094
z: 0.36514837

public void collision(CollisionEvent ce) {
if (ce.getType()==CollisionEvent.TYPE_TARGET) {
PolygonManager pm = terrain.getPolygonManager();
SimpleVector polypos = pm.getTransformedNormal(ce.getPolygonIDs()[0]);
Log.d(polypos.x+":"+polypos.y+":"+polypos.z);
}
}


edit: got it working by changing getTransformedNormal to getTransformedVertex :D
#66
Support / Polygon picking?
February 09, 2011, 11:01:35 AM
So I got my terrain now.
What I need now is something like polygon picking?
I want to be able to tap the terrain at any position and return the world-space coordinates of where I tapped the terrain.
I think the most logical way to do this is to check which polygon is being tapped on, and return it's (x y and z) position..
I was looking at http://www.jpct.net/wiki/index.php/Picking but the 'fast way' does not work on android ( ? ) as world.getVisibilityList() does not exist..
#67
Support / Re: Landscape, Model or Heightmap?
February 09, 2011, 09:50:27 AM
*testing it*
Wow, that was like.... instant :o
thanks. :)
#68
Support / Re: Landscape, Model or Heightmap?
February 08, 2011, 11:34:16 PM
lol wow, the zipped file became like 1.7mb :o
however.. using ZipInputStream on android takes forever to extract the 18mb file, and ran out of memory..
so I manually resized the heightmap to 128 and the ser file became 4mb, zip file now is only 644.2kb but still loading takes a while.
or I am doing something wrong..

ByteArrayOutputStream terr = new ByteArrayOutputStream();
ByteArrayOutputStream terrTexture = new ByteArrayOutputStream();

try {
ZipInputStream zip = new ZipInputStream(res.openRawResource(R.raw.terrain));
ZipEntry ze = null;
   
while ((ze = zip.getNextEntry()) != null) {
if(ze.getName().equals("terrain.ser")){
for (int c = zip.read(); c != -1; c = zip.read()) {
terr.write(c);
}
zip.closeEntry();
}
if(ze.getName().equals("texture.png")){
for (int c = zip.read(); c != -1; c = zip.read()) {
terrTexture.write(c);
}
zip.closeEntry();
}
}
   
} catch (IOException e) {
e.printStackTrace();
}
tm.addTexture("terrainTexture", new Texture(new ByteArrayInputStream(terrTexture.toByteArray()), false));
Object3D terrain = Loader.loadSerializedObject(new ByteArrayInputStream(terr.toByteArray()));
terrain.setTexture("terrainTexture");
terrain.build();
world.addObject(terrain);
#69
Support / Re: Landscape, Model or Heightmap?
February 08, 2011, 04:51:49 PM
yay, got it working....
exporting as ser file works too, except for the fact that it becomes a 16mb file O.o
is there a possibility script-wise, to reduce the polygons? as 65536 is kind of A LOT.


edit: resized my heightmap manually to 128x128, but that still leaves me with a 4mb file... personally I think that is too large..
#70
Support / Framerate and movement
February 07, 2011, 09:25:10 PM
When moving an object in the render loop.. lets say.. rotateX(0.01f); it will rotate faster with higher framerate and rotates slower with lower framerate..
If i remember correctly, some other sdk i once used had a function or something called AccurateTimeElapsed..
I'm not sure what it does but when calling eg, rotateX(0.001f * AccurateTimeElapsed); it would rotate at the same speed on any framerate..
is there some similar method or whatever in jPCT?
Or if someone knows how it works so that I can implement it myself ?

Kind regards,
Kaiidyn.
#71
Support / Re: Landscape, Model or Heightmap?
February 07, 2011, 08:50:18 PM
Ok, I got the pixel data now... I think..

I got a 256x256 image, so the length should be 256*256=65536, however it is 65792...
What else is in there?

Also, the pixel data in int[] is a number eg. 11053224.... what is it, and how can I 'transform' it into something I need for heightmaps?
#72
Support / Re: help with converting 3ds model
February 07, 2011, 12:10:09 PM
try reinstalling / upgrading java.
#73
Support / Re: Landscape, Model or Heightmap?
February 06, 2011, 06:42:02 PM

Wait......... what?
#74
Support / Re: Landscape, Model or Heightmap?
February 05, 2011, 01:07:20 PM
hmm, cant seem to figure it out,
got an example by any chance ?
#75
Support / Re: Landscape, Model or Heightmap?
February 05, 2011, 11:56:02 AM
How do i get the pixel data from an texture in jpct desktop version?