3D Rad - Free 3D game maker - Forum

This forum is now archived!

This forum is locked, and is a read-only version. A new community-ran forum can be found at classdev.net

News:

The 3DRad community can be found at classdev.net.

Pages: [1]

Author Topic: how I do know if my car is going in reverse?  (Read 1609 times)

« on: August 25, 2009, 10:03:29 AM »
that.
the speed seems to be a positive for both reverse and ... the other  :P (what would be the word?)

how I know when my car is going forward?

thanks!!  :)
Crashing Boxes - winner of the 3d games category at the 5th Uruguayan video game contest
get a copy for your iPad/iPhone!
« Reply #1 on: August 25, 2009, 10:28:10 AM »
Hi loop! I read your post and I think that the project may be the solution for you. See the attached project.Hope it helps.Filip
« Last Edit: July 12, 2010, 04:02:41 AM by Filip Macedonia »
« Reply #2 on: August 25, 2009, 10:38:13 AM »
perrrrrrrrrrrfect!!!

thank you very much Macedonia!!
Crashing Boxes - winner of the 3d games category at the 5th Uruguayan video game contest
get a copy for your iPad/iPhone!
« Reply #3 on: August 25, 2009, 10:42:21 AM »
Glad to be of help. ;)
« Reply #4 on: September 09, 2010, 10:38:35 PM »
The attached file no work in my PC.  :-\

What is the script?  ???
« Reply #5 on: September 09, 2010, 11:08:52 PM »
Code: [Select]
void Main()
{
   Vector3 velocityVector;
   Quaternion orientation;
   Vector3 localZVector;
   iObjectVelocity(OBJ_0,velocityVector); // OBJ_0 = CAR
   iObjectOrientation(OBJ_0,orientation);
   iVectorRotate(localZVector,Vector3(0,0,1),orientation);
   float dotProduct = iVectorDot(localZVector,velocityVector);
   if (dotProduct > 0.01)
   {
      // CAR GOING FORWARD
   }
   else if (dotProduct < -0.01)
   {
      // CAR GOING REVERSE
   }
   else
   {
      // CAR STILL
   }
}
Crashing Boxes - winner of the 3d games category at the 5th Uruguayan video game contest
get a copy for your iPad/iPhone!
« Reply #6 on: September 10, 2010, 09:59:55 AM »
Simple and usefull staff, Filip  8).
And this is the first use of dotproduct (misty math function for me) I've met in
the forum.
« Reply #7 on: September 28, 2010, 10:29:09 PM »
Thank you Loop!
Pages: [1]