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

Pages: 1 ... 9 10 [11] 12
151
Support / Re: About the object "LookAt" , need help
« on: June 10, 2014, 02:20:48 am »
Hello EgonOlsen,  I use code like this:


//get the car current  position
SimpleVector poscur = car.getTransformedCenter();

//get the car lookat waypoint , the  nav point is ahead of car
SimpleVector posLookat = getLookatwaypoint();

posLookat .scalarMul(-1f);
posLookat .add(poscur );
Matrix rotY=posLookat .getRotationMatrix();
car.setRotationMatrix(rotY);


If  I change code  as follow:
.....
poscur .scalarMul(-1f);
poscur .add(posLookat );
Matrix rotY=poscur .getRotationMatrix();
car.setRotationMatrix(rotY);

the effect is  the car 's forward becomes back , please look at the attache picture ,
How can I do ?  thank s   ~




[attachment deleted by admin]

152
Support / About the object "LookAt" , need help
« on: June 09, 2014, 05:17:06 pm »
I reference   this topic -   Simulate "camera.lookAt(SimpleVector)" for an Obje ,   set my car rotation matrix, but  it's not ok ,the  car's wheels are up,
what's wrong ?   help me , please ,thanks  ...

[attachment deleted by admin]

153
Hello !  I can use camera  "walk along" the road ,it seems ok.  Now , I add a car into the world and let the camera  follow it , the car's position set by

SimpleVector pos = waypoint[WayID];
car.clearTranslation();
car.translate(pos);

the camera position set by

          pos.x -=2;
          pos.y += 60;
          pos.z -= 40;

cam.setPosition(pos);

but  the car  position is seems not ok ,   it somtimes lost on road,  camera is always ok , because I  always "walk along" the road  , I try to find object3d  setposition function , but  I only found  translate function , please help me , thanks !

154
thanks ,I will try it   ~~

155
sorry ,still incorrect  means that  I want to walk along the road , I always see the road ,but the result is not always on the road and sometimes the road not seen ....

156
The model export from unity3d  and  changed type by 3dsmax,   I  can see the road and waypoint in application, the picture is captured from my handset 

[attachment deleted by admin]

157
Here is  my used  3d model , the way point named WP_1 WP_2 .... WP_43

[attachment deleted by admin]

158
HI,  I  do a  simple test,  the "walk step" is 1, when I  click the screen ,the WayID ++,  set camera position like this:

cam.setPosition(waypoint[WayID].calcAdd(waypoint[WayID+1].calcSub(waypoint[WayID])));

but the camera position still incrocrect,  I don't know why?

I  load 3d model like this:

try
            {
               
                obj = Loader.loadOBJ(res.getAssets().open("road.obj"),null,0.05f);

               
            saidao =Object3D.mergeAll(Loader.loadOBJ(res.getAssets().open("road.obj"),null,0.05f));//
               
            }
            catch (IOException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
               Log.v("ttt", "load error!");
            }
            TextureManager.getInstance().addTexture("road", new Texture(res.openRawResource(R.raw.road)));

            saidao.rotateX((float) (Math.PI) / 1f);
            saidao.translate(0,10,0);
            saidao.build();
            world.addObject(saidao);
            
             int k = 0;
              for(int i = 0; i < obj.length; i++){
                   //world.addObject(obj);
                   if(obj.getName().contains("WP_")){
                      obj.build();
                      waypoint[k] = obj.getTransformedCenter();
                     
                      wayNav[k] = obj;
                      k++;
                      Logger.log(obj.getTransformedCenter() + "-->GET WP->"+obj.getName());
                   }
                   else if(obj.getName().contains("Road"))
                   {
                      obj.setTexture("road");
                   }
                        
                   }

the  print is :
05-30 22:06:30.230: I/jPCT-AE(886): (-412.28714,1.8050749,1105.2081)-->GET WP->WP_1_jPCT1
05-30 22:06:30.230: I/jPCT-AE(886): Normal vectors calculated in 1ms!
05-30 22:06:30.230: I/jPCT-AE(886): (-482.62927,1.3220211,1107.2769)-->GET WP->WP_2_jPCT2
05-30 22:06:30.230: I/jPCT-AE(886): Normal vectors calculated in 1ms!
05-30 22:06:30.230: I/jPCT-AE(886): (-625.3562,1.3489301,1113.7605)-->GET WP->WP_3_jPCT3
.....................


Is there is something wrong ? thanks

159
thank you very much !  I will try it soon  and give the result ...

160
Maybe my poor english...                  I have got the waypoint from 3d model ,  and I  set the camera position like this:

Camera cam = world.getCamera();

SimpleVector p = waypoint[WayID];

p.y -= 20;
p.z -= 100;
cam.setPosition(p);

but it seems the camera position is not correct(it should always on the road ,like a man walk on the road) ,  My purpose is to "walk along" on road so  my car can to do so,
sorry  for my poor english~~




161
I want  my car  run along the road,and the camera follow the car , like this:


[attachment deleted by admin]

162
I can't walk along the way by way point, it seems the carmera position  not incrocet

163
The log seems  ok 

164
I add waypoint in 3D mode, the waypoint as the children of road, I  load the road  like this;

Object3D[] obj;
obj = Loader.loadOBJ(res.getAssets().open("road.obj"),null,0.05f);
for(int i = 0; i < obj.length; i++){
                   //world.addObject(obj);
                   if(obj.getName().contains("WP_")){
                      obj.build();
                      waypoint[k] = obj.getTransformedCenter();
                     
                      wayNav[k] = obj;
                      k++;
                    
                   }

so the waypoint postion are got

165
Anyone help  me?

Pages: 1 ... 9 10 [11] 12