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 - pangjiale

#1
Support / Re: Collision Detection about the demo car
October 23, 2007, 03:19:01 AM
thank you very much.

it works well when I have added moveForward() methord of the Bullet.java into the Car.java

#2
Support / Collision Detection about the demo car
October 22, 2007, 10:59:38 AM

hello, I was reviewing the demo the Car . It is a great work although I cant understand something about the collision.

I had made a  modification on the demo so that the collision would be detected when the car collide with a plant .

unfortunately that dosenot work and the program goes on running .Am I missing something? Thanks in advance.

this is what I have modified on the demo:

Car.java
   public Car() { 
     ...
    setCollisionMode(Object3D.COLLISION_CHECK_SELF|Object3D.COLLISION_CHECK_OTHERS); 
   }

2 BulletPlantListener.java
   
    ...
    public void collision(CollisionEvent e) {
      if (e.getType()==CollisionEvent.TYPE_TARGET && e.getSource()!=null) {
        
          if (e.getSource() instanceof Car) {
             System.out.println("Collide now");    //doesnot happen. sorry        
          }
    }
    ...
    }