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 - dl.zerocool

Pages: 1 2 [3] 4 5 ... 7
31
Support / Collision between 2 models.
« on: May 30, 2010, 04:32:12 pm »
Hi,

I'm using :
Code: [Select]
cId = checkForCollision(dir, step);where step =2f and dir is a direction SimpleVector from a projectile (he moves along this dir)

My problem is :

I've a projectile :  That I want to move except if there's a collision and in this case I want to do something else.
So basicaly I use checkForCollision each time before moving.
Code: [Select]
if(cId==NO_OJBECT)then I move
else
do something else.

My projectiles are configured like this when I create a project :
Code: [Select]
       addCollisionListener(this);
setCollisionMode(COLLISION_CHECK_SELF);
setCollisionOptimization(COLLISION_DETECTION_OPTIMIZED);

Now the objects I want to collide with have this settings
Code: [Select]
addCollisionListener(this);
setCollisionMode(COLLISION_CHECK_OTHERS);
setCollisionOptimization(COLLISION_DETECTION_OPTIMIZED);

The problem is that even I'm seeing that the 2 objects are colliding cID still equal to NO_OBJECT
so no collision detected.


Am I doing something wrong ?



32
Support / Re: Moving an Object3D to another smoothly.
« on: May 29, 2010, 10:03:20 am »
Solved,

Ahhh... I can't trust this kind of things ^^

It was that, the camera from Player was not the Camera from jpct
But the object camera that Player created because he was extending Camera...

what is strange it that sensors does had effect on the Player.rotate  things who where functions from Camera directly...
Now what I do is pretty simple, Player is not more extending Camera, when I create a Player I pass a camera object
and I reimplemented the methods I need to call on Player.

So basically a composition :P

Thanks for your help !

33
Support / Re: Moving an Object3D to another smoothly.
« on: May 29, 2010, 09:56:10 am »
I think I've found something it's probably related to the fact that Player inerith from Camera.
When a player is create it does automaticly call constructor from Camera
perhaps at this moment it does override the jpct world camera.

I'm trying to do this with a composition instead.

34
Support / Re: Moving an Object3D to another smoothly.
« on: May 29, 2010, 09:46:38 am »
Here you have it : (First fire)
Code: [Select]
05-29 09:44:44.009: INFO/System.out(16056): Live a bee : Bee0 id: 6
05-29 09:44:44.029: INFO/System.out(16056): Camera onFire getPosition(0.0,0.0,0.0)
05-29 09:44:44.039: INFO/System.out(16056): Camera onFire getDirection(0.0,0.0,1.0)
05-29 09:44:44.039: INFO/System.out(16056): Camera onFire getBack(
05-29 09:44:44.039: INFO/System.out(16056):     1.0    0.0    0.0    0.0
05-29 09:44:44.039: INFO/System.out(16056):     0.0    1.0    0.0    0.0
05-29 09:44:44.039: INFO/System.out(16056):     0.0    0.0    1.0    0.0
05-29 09:44:44.039: INFO/System.out(16056):     0.0    0.0    0.0    1.0
05-29 09:44:44.039: INFO/System.out(16056): )


After rotation : (snd Fire)
Code: [Select]
05-29 09:44:46.579: INFO/System.out(16056): Camera onFire getDirection(0.0,0.0,1.0)
05-29 09:44:46.589: INFO/System.out(16056): Camera onFire getBack(
05-29 09:44:46.589: INFO/System.out(16056):     1.0    0.0    0.0    0.0
05-29 09:44:46.589: INFO/System.out(16056):     0.0    1.0    0.0    0.0
05-29 09:44:46.589: INFO/System.out(16056):     0.0    0.0    1.0    0.0
05-29 09:44:46.589: INFO/System.out(16056):     0.0    0.0    0.0    1.0
05-29 09:44:46.589: INFO/System.out(16056): )

After more rotation (just in case) :
Code: [Select]
05-29 09:44:50.359: INFO/System.out(16056): Camera onFire getPosition(0.0,0.0,0.0)
05-29 09:44:50.359: INFO/System.out(16056): Camera onFire getDirection(0.0,0.0,1.0)
05-29 09:44:50.359: INFO/System.out(16056): Camera onFire getBack(
05-29 09:44:50.359: INFO/System.out(16056):     1.0    0.0    0.0    0.0
05-29 09:44:50.359: INFO/System.out(16056):     0.0    1.0    0.0    0.0
05-29 09:44:50.359: INFO/System.out(16056):     0.0    0.0    1.0    0.0
05-29 09:44:50.359: INFO/System.out(16056):     0.0    0.0    0.0    1.0
05-29 09:44:50.359: INFO/System.out(16056): )



35
Support / Re: Moving an Object3D to another smoothly.
« on: May 29, 2010, 09:35:19 am »
Better print to understand :  start direction is  getDirection from camera  and start position getPosition.
Called each time a bee is fire

[First fire -> camera looking scene]
Code: [Select]
05-29 09:32:46.719: INFO/System.out(15615): Bee start direction : (0.0,0.0,1.0)
05-29 09:32:46.719: INFO/System.out(15615): Bee start position: (0.0,0.0,0.0)
05-29 09:32:46.719: INFO/System.out(15615): Live a bee : Bee0 id: 6

[Second fire -> camera looking away]
Code: [Select]
05-29 09:32:50.869: INFO/System.out(15615): Bee start direction : (0.0,0.0,1.0)
05-29 09:32:50.869: INFO/System.out(15615): Bee start position: (0.0,0.0,0.0)
05-29 09:32:50.879: INFO/System.out(15615): Live a bee : Bee0 id: 6


[edit]
since I only apply rotation to camera I understand that position never change
but direction should change T_T

36
Support / Re: Moving an Object3D to another smoothly.
« on: May 29, 2010, 09:31:12 am »
hmmmm I'm going to check this, but getDirection and getPosition are in one thread (game)

Sensors are initialized inside Game so basically rotates called by sensors event should be made inside game thread.
sensors are certainly threaded by android of course but I don't think this is the problem.

Because it should only cause a small change in angle in case fire bee is called before the angle is updated by sensors.
So this is not the case

The case is that it's always fired to ->initial getDirection

When I start the game Camera looking at center of the scene :
Code: [Select]
05-29 08:18:36.314: INFO/System.out(12161): End initialisation
05-29 08:18:38.844: INFO/System.out(12161): Bee : Bee0 IA id: 6
05-29 08:18:38.854: INFO/System.out(12161): Bee dir : (0.0,0.0,1.0)
05-29 08:18:38.854: INFO/System.out(12161): Bee start : (0.0,0.0,0.0)


After moved the camera and waited a while (to be sure that camera values have been update, but of cours they where because the camera moved)
Bee0 had time to die that's why it's again bee0 who is fired.
Code: [Select]
05-29 08:18:41.014: INFO/System.out(12161): Bee : Bee0 IA id: 6
05-29 08:18:41.014: INFO/System.out(12161): Bee dir : (0.0,0.0,1.0)
05-29 08:18:41.014: INFO/System.out(12161): Bee start : (0.0,0.0,0.0)



37
Support / Re: Moving an Object3D to another smoothly.
« on: May 29, 2010, 09:03:46 am »
Oh strange.

Let me just show what I do:
Quote
tiltSensors.addSensorsListener(new SensorEventAdapter() {
       public void onOrientationChanged(OrientationEvent e) {
      // NOT A GOOD IDEA !!!! initial camera position should be kept
      // when initialized and then the necessary angle calculated.
      PLAYER.lookAt(honeyPot);
      PLAYER.rotateCameraY(e.yaw);
      PLAYER.rotateCameraX(-e.roll);
      // PLAYER.rotateCameraZ(e.pitch);
       }
   });
PLAYER inherits from Camera so it's a camera with few more members and function I added ( I know it should be composed instead of inheriting but I've very few time left and I'm doing as fast as I can).

now when I shout a projectile I take the vector direction and position to get the "starting point + direction" of the projectile.

I've just a little function live wich create the projectile
Code: [Select]
public void live(SimpleVector start, SimpleVector dir) {
this.dir = dir;
alive = true;
System.out.println("Bee : " + getName() + " IA id: " + getID());
System.out.println("Bee dir : " + dir.toString());
System.out.println("Bee start : " + start.toString());
translate(start);
//rotateY(Game.ROTATION_Y_FACE_SCENE_FROM_CAMERA);
show();
enableCollisionListeners();
    }

So nothing big here...
Then to move the projectile I do this

              dir.add(dir);
              translate(dir);

The problem is when I do this.
Code: [Select]
   
public void onFireBee()
    {
for(Weapon w: bees){
   if(!w.isALive()){
w.live(PLAYER.getPosition(), PLAYER.getDirection());
System.out.println("Live a bee : "+w.getName()+" id: "+w.getID());
break;
   }
}
I just "create" make a projectile alive, on an arraylist of projectiles when a button is pressed.

That's all, but when I do this the projectile still follow the initial camera direction not the current one...

ps: I don't touch camera values or function inside PLAYER, it's a direct call to Camera functions.

38
Support / Re: Moving an Object3D to another smoothly.
« on: May 29, 2010, 08:45:49 am »
No sadly I'm not,

There's rotateCameraY(Rotates the camera around the y-axis.)  and rotateY wich(Rotates the backbuffer matrix around the y-axis.)

I'm using rotateCameraY

and when I do a getDirection I get the direction that the camera what initially pointing, not the current direction.

39
Support / Re: Moving an Object3D to another smoothly.
« on: May 29, 2010, 08:28:16 am »
I've another problem, I'm using camera.getDirection()

But even if I move the camera with camera.rotateCameraX/Y/Z
getDirection still continue to give me the direction of the backbuffer and not the actual poiting camera direction.

Is there a way to solve this ?

I shot projectiles from the camera position and direction that's why I need this.

[edit] I'm using rotateCamera  not rotate.

40
Support / Re: Version updates!
« on: May 29, 2010, 07:31:07 am »
Sound really nice !

41
Projects / Re: Alpha version of Benchmark, was: GUI example anyone?
« on: May 28, 2010, 07:05:38 pm »
Nexus one results (533*320)
Fillrate ST/MT: 10.12/10.04 MP/sec.
High object count: 19.14 fps
Multiple lights: 51.08 fps
High polygon count: 23.03 fps
Keyframe animation: 60.47 fps
Game level: 24.71 fps
Total Score: 4856

(About the spica, I don't have access to it right now I'll try again Monday when I'll have again access to spica)


42
Support / Re: Moving an Object3D to another smoothly.
« on: May 28, 2010, 05:19:17 pm »
^^Sorry I forgot to inherit Camera
That's why I wasn't seeing the method.

43
Support / Re: Moving an Object3D to another smoothly.
« on: May 28, 2010, 02:22:03 pm »
Another question, is it possible to know world camera position ?

44
Support / Re: Version updates!
« on: May 27, 2010, 11:09:37 pm »
I do agree Dalvik do react very very strangely.

[Edit]
Okay so I'll use strip since I don't use any of the polygon methods on my objects.

45
Support / Re: Version updates!
« on: May 27, 2010, 10:20:29 pm »
Another question is it really necessary to run strip on models after build ?
I would like to know if there's an improvement, I can't find where to see how much RAM my app is allocating so I can't really test if it's better or not :(

Pages: 1 2 [3] 4 5 ... 7