Hello,

On Friday 16 February 2007 11:29:37 Jorrit Tyberghein wrote:
> Seems ok. Personally though I'm wondering why you're doing this. If I
> walk on a slope I will still try to stand straigth up. I don't think
> it is realistic for a human character to follow the slope like that.

Yes but I used the cal3d cally model for testing only... I plan to put a 
vehicle instead. 

Thank you for your answer.
Quentin


> On 2/15/07, Quentin Anciaux <[EMAIL PROTECTED]> wrote:
> > Hello,
> >
> > ok seems like doing this:
> >
> >                 iMovable movable = this.hulk.GetMovable();
> >                 csReversibleTransform transform = movable.GetTransform();
> >                 csVector3 newPos = transform.GetOrigin().add(
> >                                
> > transform.GetFront().multiply(-elapsed_second * speed)); csHitBeamResult
> > hbr = meshTerrain.HitBeam(
> >                                 new
> > csVector3(newPos.getX(),-100,newPos.getZ()), new
> > csVector3(newPos.getX(),100,newPos.getZ()) );
> >                 newPos = hbr.getIsect();
> >                 csHitBeamResult v1 = meshTerrain.HitBeam(
> >                                 new
> > csVector3(newPos.getX(),-100,newPos.getZ()+0.1f), new
> > csVector3(newPos.getX(),100,newPos.getZ()+0.1f)); csHitBeamResult v2 =
> > meshTerrain.HitBeam(
> >                                 new
> > csVector3(newPos.getX()-0.1f,-100,newPos.getZ()-0.1f), new
> > csVector3(newPos.getX()-0.1f,100,newPos.getZ()-0.1f)); csHitBeamResult v3
> > = meshTerrain.HitBeam(
> >                                 new
> > csVector3(newPos.getX()+0.1f,-100,newPos.getZ()-0.1f), new
> > csVector3(newPos.getX()+0.1f,100,newPos.getZ()-0.1f)); csPlane3 plane =
> > new csPlane3(
> >                                 v1.getIsect(),
> >                                 v2.getIsect(),
> >                                 v3.getIsect()
> >                 );
> >                 csVector3 norm = plane.Normal();
> >                 norm.Normalize();
> >                 if (norm.getY() < 0.0f) {
> >                         norm = norm.multiply(-1.0f);
> >                 }
> >                 float ax = (float)-(Math.PI/2-Math.acos(norm.multiply(new
> > csVector3 (0,0,1))));
> >                 float az = (float)(Math.PI/2-Math.acos(norm.multiply(new
> > csVector3 (1,0,0))));
> >                 movable.SetTransform(new csOrthoTransform(
> >                                 new csYRotMatrix3(this.hulkRotY)
> >                                 .multiply(new csXRotMatrix3(ax))
> >                                 .multiply(new csZRotMatrix3(az))
> >                                 ,newPos));
> >                 movable.UpdateMove();
> >
> > yield the correct result...
> > http://www.allcolor.org/terrain-character-pos2.png
> >
> > Is this correct ?
> >
> > Thanks,
> > Quentin Anciaux
> >
> > On Thursday 15 February 2007 10:54:44 Quentin Anciaux wrote:
> > > Hi, I tried...
> > >
> > > But I don't have the result I wish... see
> > > http://www.allcolor.org/terrain-character-pos.png
> > >
> > > To arrive at this, I first hitbeam the character position with the
> > > terrain to find the elevation.
> > > Then I do three hitbeams near the character to form a plane and get the
> > > normal, then I compute the angle with the X and Z axis... but this is
> > > not correct.... someone could help me ?
> > >
> > > I used the following code to position the character (please not this is
> > > in java).
> > >
> > >               iMeshWrapper meshTerrain =
> > > this.app.getEngine().FindMeshObject("Terrain");
> > > CDebug.assertNotNull(meshTerrain);
> > >               iMovable movable = this.hulk.GetMovable();
> > >               csReversibleTransform transform = movable.GetTransform();
> > >               csVector3 newPos = transform.GetOrigin().add(
> > >                              
> > > transform.GetFront().multiply(-elapsed_second * speed));
> > > csHitBeamResult hbr = meshTerrain.HitBeam(
> > >                               new
> > > csVector3(newPos.getX(),-100,newPos.getZ()), new
> > > csVector3(newPos.getX(),100,newPos.getZ()) );
> > >               newPos = hbr.getIsect();
> > >               csHitBeamResult v1 = meshTerrain.HitBeam(
> > >                               new
> > > csVector3(newPos.getX()+0.1f,-100,newPos.getZ()), new
> > > csVector3(newPos.getX()+0.1f,100,newPos.getZ())); csHitBeamResult v2 =
> > > meshTerrain.HitBeam(
> > >                               new
> > > csVector3(newPos.getX()-0.1f,-100,newPos.getZ()), new
> > > csVector3(newPos.getX()-0.1f,100,newPos.getZ())); csHitBeamResult v3 =
> > > meshTerrain.HitBeam(
> > >                               new
> > > csVector3(newPos.getX()+0.1f,-100,newPos.getZ()+0.1f), new
> > > csVector3(newPos.getX()+0.1f,100,newPos.getZ()+0.1f)); csPlane3 plane =
> > > new csPlane3(
> > >                               v1.getIsect(),
> > >                               v2.getIsect(),
> > >                               v3.getIsect()
> > >               );
> > >               csVector3 norm = plane.Normal();
> > >               norm.Normalize();
> > >               if (norm.getY() < 0.0f) {
> > >                       norm = norm.multiply(-1.0f);
> > >               }
> > >               movable.SetTransform(new csOrthoTransform(
> > >                               new
> > > csYRotMatrix3(this.hulkRotY).multiply( new csZRotMatrix3( (float)
> > > (Math.PI/2-Math.acos(norm.multiply(new csVector3(0,0,1)))) ).multiply(
> > >                                                               new
> > > csXRotMatrix3( (float) (Math.PI/2-Math.acos(norm.multiply(new
> > > csVector3(1,0,0)))) )
> > >                                               )
> > >                               )
> > >                               ,newPos));
> > >               movable.UpdateMove();
> > >
> > > and I used the following code to position the camera:
> > >
> > > csReversibleTransform spriteTransform = this.hulk.GetMovable()
> > >                               .GetTransform();
> > >               csReversibleTransform cameraTransform =
> > > camera.GetTransform(); csVector3 cameraOrigin =
> > > spriteTransform.GetOrigin().add(new csVector3 (0,2,-8));
> > >               cameraTransform.SetOrigin(cameraOrigin);
> > >               csVector3 lookAt =
> > > cameraOrigin.subtract(spriteTransform.GetOrigin()).multiply(-1.0f);
> > >               cameraTransform.LookAt(lookAt,this.cameraOrientation);
> > >
> > >
> > > Quentin Anciaux
> > >
> > > On Thursday 15 February 2007 00:49:18 Andrew Robberts wrote:
> > > > csReversibleTransform has a LookAt function that will compute a
> > > > look-at transform.
> > > >
> > > > So, you can use this to compute a transform that will "look" towards
> > > > the normal of the terrain.  You can do this by doing the following:
> > > >
> > > > csReversibleTransform rt;
> > > > rt.LookAt(terrainNormal, csVector3(0,1,0));
> > > > csMatrix3 mat = rt.GetT2O();
> > > > meshWrapper->GetMovable()->SetTransform(mat);
> > > >
> > > > This should orient your mesh so that some part of it is facing down
> > > > the terrain, but it probably won't be the correct part.  I can't
> > > > remember off the top of my head which way the lookat will orient, but
> > > > you can fix this with a bit of trial and error.  What you'll have to
> > > > do is rotate your character and then apply the lookat transform.
> > > >
> > > > For example, if your character's back faces the direction you want
> > > > its front to face then you can change line 3 to:
> > > >
> > > > csMatrix3 mat = rt.GetT2O() * csYRotMatrix3(3.14f);
> > > >
> > > > 3.14f is a half-turn rotation.
> > > >
> > > > If your character isn't even standing upright, then you'll probably
> > > > have to apply a rotation around the X axis:
> > > >
> > > > csMatrix3 mat = rt.GetT2O() * csXRotMatrix3(3.14f * 0.5f); // half of
> > > > 3.14fis a quarter turn
> > > >
> > > > If neither is sufficient then you might have to combine the two in
> > > > some way:
> > > >
> > > > csMatrix3 mat = rt.GetT2O() * csYRotMatrix3(3.14f) *
> > > > csXRotMatrix3(3.14f * 0.5f);
> > > >
> > > > or something similar.  If you play around with it then you should get
> > > > a feel for transforming your character and manage to get him facing
> > > > the right way.
> > > >
> > > > --
> > > > Andrew Robberts
> > > >
> > > > On 2/14/07, Quentin Anciaux <[EMAIL PROTECTED]> wrote:
> > > > > Hi,
> > > > >
> > > > > I've another question now that I know how to find the elevation. I
> > > > > would like
> > > > > the character displayed on the surface not only to be shown at the
> > > > > correct elevation but also to "rotate" according to the vector
> > > > > perpendicular (normal ?) from the terrain... How can I do ?
> > > > >
> > > > > Thank you very much, any help is appreciated.
> > > > >
> > > > > Quentin Anciaux
> > > > >
> > > > > -------------------------------------------------------------------
> > > > >---- -- Take Surveys. Earn Cash. Influence the Future of IT
> > > > > Join SourceForge.net's Techsay panel and you'll get the chance to
> > > > > share your
> > > > > opinions on IT & business topics through brief surveys-and earn
> > > > > cash
> > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=
> > > > >DEVD EV _______________________________________________
> > > > > Crystal-main mailing list
> > > > > [email protected]
> > > > > https://lists.sourceforge.net/lists/listinfo/crystal-main
> > > > > Unsubscribe: mailto:[EMAIL PROTECTED]
> > > > > ?subject=unsubscribe
> > >
> > > -----------------------------------------------------------------------
> > >-- Take Surveys. Earn Cash. Influence the Future of IT
> > > Join SourceForge.net's Techsay panel and you'll get the chance to share
> > > your opinions on IT & business topics through brief surveys-and earn
> > > cash
> > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVD
> > >EV _______________________________________________
> > > Crystal-main mailing list
> > > [email protected]
> > > https://lists.sourceforge.net/lists/listinfo/crystal-main
> > > Unsubscribe:
> > > mailto:[EMAIL PROTECTED]
> >
> > -------------------------------------------------------------------------
> > Take Surveys. Earn Cash. Influence the Future of IT
> > Join SourceForge.net's Techsay panel and you'll get the chance to share
> > your opinions on IT & business topics through brief surveys-and earn cash
> > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> > _______________________________________________
> > Crystal-main mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/crystal-main
> > Unsubscribe:
> > mailto:[EMAIL PROTECTED]



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Crystal-main mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/crystal-main
Unsubscribe: mailto:[EMAIL PROTECTED]

Reply via email to