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.


Messages - phoenicoperus

Pages: [1]
1
Support / Re: Intersection of SimpleVector
« on: March 06, 2011, 04:43:38 am »
It works great. Like always... THANKS your are always there EgonOlsen!!!!!

Btw I want to help you with the wiki to make it easier for beginners how can I get an account?

2
Support / Intersection of SimpleVector
« on: March 05, 2011, 10:29:37 pm »
Hi, I was wondering if there was an easy way to find the intersection of a sphere and a line using jptc api.

I want to translate an Object3D(object#1) from its original position to a given radius from the centre of another Object3D(object#2) but taking in count the object#1 direction (SimpleVector)
 


The idea is to travel from an object to a distance of another

 :)

3
Support / Re: Move Camera around a scene
« on: March 01, 2011, 06:13:58 am »
well playing with the emulator fps and angle value and comparing it to the fps and angle value of the nexus one, I obtained a simple y=mx+b equation assuming the angle/fps has a linear relation.

Code: [Select]
camera.rotateCameraAxis(m.invert3x3().getXAxis(),
-line.length() / (((10/45)*fps) + 25))

It seems to work fairly well in the nexus but I guess I'll have to test in in different devices.

Maby you can think of a better way ^_^



4
Support / Re: Move Camera around a scene
« on: March 01, 2011, 12:14:11 am »
I solved the flickering when keeping the finger still on screen by adding a simple if statement
Code: [Select]
line.set(-touchTurn, 0, touchTurnUp);
m = line.normalize(line).getRotationMatrix(m);
m.rotateAxis(m.getXAxis(), (float) -Math.PI / 2f);
if((touchTurn > 0.01f || touchTurn < -0.01f) || (touchTurnUp > 0.01f || touchTurnUp < -0.01f))
{
camera.moveCamera(Camera.CAMERA_MOVEIN, 50); // 50 is the distance from the cube's center that the camera has
camera.rotateCameraAxis(m.invert3x3().getXAxis(), -line.length() / 15f); // 5f actually depends on render speed
camera.moveCamera(Camera.CAMERA_MOVEOUT, 50);
touchTurn = 0;
touchTurnUp = 0;
}

now I just have to do the method that calculates the rotate camera angle depending on the frames per second or time passed to render the last frame, although I'm not sure of how I'm going to achieve this ??? I'm trying with the fps approach but rotation suddenly accelerates : ( , I'll keep trying to get a reliable value for this (and constant) ; )

5
Support / Re: Move Camera around a scene
« on: February 28, 2011, 10:04:03 pm »
Thank you so much, for your time and your help. In return Ill try to make a clear commented example for the the wiki and make a smoother method controlling leaving the finger on the screen and the 5f calc method. Once again thanks ^_^


6
Support / Re: Move Camera around a scene
« on: February 28, 2011, 08:59:34 pm »
The movement of the camera is correct, that's the idea of how it should behave but its way too sensitive, I'm testing it in a nexus one.

I can see the comment "// 5f actually depends on render speed" so there should be a way of dynamically calculate it so it works the same in each device

7
Support / Re: Move Camera around a scene
« on: February 28, 2011, 07:12:08 pm »
Here is the HelloWorldCamera with the camera rotation. I'm trying to achieve the exact same feel as the normal HelloWorld but moving the camera instead of rotating the object. As you can see my problem is that I don't know how to code a lookAt method that matches the expected behaviour.

HelloWorldCamera:
http://www.mediafire.com/?8p4lcdqefzbhg3o

8
Support / Re: Move Camera around a scene
« on: February 28, 2011, 06:32:09 pm »
Since there is unlimited ways of looking at something, I'm trying to set the camera relative to the camerapivot dummy
Code: [Select]
private void resetCameraPosition() {
camera.setPosition(cameraSatellite.getTransformedCenter());
camera.setBack(cameraPivot.getRotationMatrix().cloneMatrix().invert());
}

although it still doesn't feel right.

The problem I have implementing your method is that I'm not sure how to make it interact with touchTurn and touchTurnUp.

Ill upload the modified hello world if we can get this one right It will be very good example for the wiki which currently only has info about fps style camera

9
Support / Re: Move Camera around a scene
« on: February 28, 2011, 04:38:49 pm »
Thanks ill give it a try, although its going to be hard for me to change it to android :(, and I was really looking for the dummy implementation.

10
Support / Re: Move Camera around a scene
« on: February 28, 2011, 02:47:17 am »
I'm also using the dummy approach but I have a strange behaviour.

when I rotate the pivot dummy all works until I get closer to the top (90º) of the rotation, if I use camera.lookAt(), the camera should be upside down if you pass the top of the rotation, but it always stays upright, that causes a very nasty feel.

I also thought about using camera.setOrientation(dir,up) but I cant get it right.

The goal is to achieve a camara that moves around the object at a constant 3d radius with the camera Oriented to the centre of the object with "the exact same feel as the helloWorld AE" but rotating and moving the camera instead of rotating the 3dobject with a fixed camera

Here Is what I tried so far:
Code: [Select]
private void resetCameraPosition() {
camera.setPosition(cameraSatellite.getTransformedCenter());
camera.lookAt(cameraPivot.getTransformedCenter());
}

private void initCamera() {

                //move the dummy pivot to the centre of the 3dobject
cameraPivot = Object3D.createDummyObj();
cameraPivot.translate(calcTrans(cameraPivot, 3dobject));

                //move the dummy satellite to the centre of the 3dobject and separated it by a radius (-20)
cameraSatellite = Object3D.createDummyObj();
cameraSatellite.translate(calcTrans(cameraSatellite, 3dobject));
cameraSatellite.translate(new SimpleVector(0, 0, -20));

                //Made child
cameraPivot.addChild(cameraSatellite);

camera = world.getCamera();
resetCameraPosition();
}


 
To turn the cameraPivot dummy I'm using the same code as in the AE helloWorld
Code: [Select]
if (touchTurn != 0) {
cameraPivot.rotateY(touchTurn);
resetCameraPosition();
// camera.rotateCameraY(touchTurn);
touchTurn = 0;
}

if (touchTurnUp != 0) {
cameraPivot.rotateX(touchTurnUp);
resetCameraPosition();
// camera.rotateCameraX(touchTurnUp);
touchTurnUp = 0;
}


I also tried several approaches for the resetCameraPosition() method, including getBack with invert, setOrientation etc etc. And none of them behaved as I would expect : (

Any idea of how to get this one right? Maby someone could do an example of the helloWorld using camera rotation instead of primitive cube rotation. It would be very handy.

Pages: [1]