61
Support / Re: Rotate camera around point
« on: February 12, 2011, 09:11:37 pm »
I'm probably being stupid, but I don't get it...
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.
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);
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);
}
}
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);