Commits

Ilija Boshkov committed 119bb3a

Fixed vehicle setup utility. Camera and vehicle using the correctcoordinate system.

Comments (0)

Files changed (3)

Demos/Vehicle/src/HkOgreVehicleDemo.cpp

 		// The chassis MUST have m_motionType hkpMotion::MOTION_BOX_INERTIA to correctly simulate
 		// vehicle roll, pitch and yaw.
 		chassisInfo.m_motionType = hkpMotion::MOTION_BOX_INERTIA;
-		chassisInfo.m_position = hkVector4(-772, 441, 1906);//hkVector4(0, 10, 0);
+		chassisInfo.m_position = hkVector4(0, 10, 0);
 		hkpInertiaTensorComputer::setShapeVolumeMassProperties(chassisInfo.m_shape,
 			chassisInfo.m_mass,
 			chassisInfo);
 	Ogre::SceneNode* carNode = mSceneMgr->getRootSceneNode()->createChildSceneNode("car");
 	Ogre::SceneNode* chassisNode = carNode->createChildSceneNode("chassis");
 	chassisNode->attachObject(mSceneMgr->createEntity("evo chassis", "Evo-Chassis.mesh"));
-	//chassisNode->rotate(Ogre::Quaternion(sqrt(0.5), 0, sqrt(0.5), 0));
 	HkOgre::hkRenderable* carRend = new HkOgre::hkRenderable(carNode, chassisRigidBody); 
 
 	// Let's create the graphical wheels

HkOgre/Utilities/Vehicle/VehicleSetup.cpp

 
 	// The coordinates of the chassis system, used for steering the vehicle.
 	//										up					forward				right
-	data.m_chassisOrientation.setCols( hkVector4(0, 1, 0), hkVector4(1, 0, 0), hkVector4(0, 0, 1));
+	data.m_chassisOrientation.setCols( hkVector4(0, 1, 0), hkVector4(0, 0, 1), hkVector4(-1, 0, 0));
 	// OGRE Uses a different coordinate system, so:
 	//										up					forward				right
 	//										+Y					+Z					+X
 		suspension.m_wheelParams[1].m_hardpointChassisSpace.set (	1,		hardPointY,		1.5		); 
 		suspension.m_wheelParams[2].m_hardpointChassisSpace.set (	-1,		hardPointY,		-1.25		); 
 		suspension.m_wheelParams[3].m_hardpointChassisSpace.set (	1,		hardPointY,		-1.25		); 
+// suspension.m_wheelParams[0].m_hardpointChassisSpace.set (1,hardPointY,-1.5); //left front wheel  
+// suspension.m_wheelParams[1].m_hardpointChassisSpace.set (1,hardPointY,1.5); //right front wheel  
+// suspension.m_wheelParams[2].m_hardpointChassisSpace.set (-1,hardPointY,-1.5); //left rear  
+// suspension.m_wheelParams[3].m_hardpointChassisSpace.set (-1,hardPointY,1.5); //right rear  
 	}
 
 	const hkVector4 downDirection( 0.0f, -1.0f, 0.0f );

HkOgre/Utilities/Vehicle/VehicleUtils.h

 			int stride = sizeof(hkReal) * 4;
 
 			HK_ALIGN16(hkReal vertices[] )= { 
-				xSize, ySize, zSize, 0.0f,		// v0
-				xSize, ySize, -zSize, 0.0f,		// v1
-				xSize, -ySize, zSize, 0.0f,		// v2
-				xSize, -ySize, -zSize, 0.0f,	// v3
-				-xSize, -ySize, zSize, 0.0f,	// v4
-				-xSize, -ySize, -zSize, 0.0f,	// v5
+				xSize, ySize, -zSize, 0.0f,		// v0
+				xSize, ySize, zSize, 0.0f,		// v1
+				xSize, -ySize, -zSize, 0.0f,		// v2
+				xSize, -ySize, zSize, 0.0f,	// v3
+				-xSize, -ySize, -zSize, 0.0f,	// v4
+				-xSize, -ySize, zSize, 0.0f,	// v5
 
-				xBumper, yBumper, zBumper, 0.0f,	// v6
-				xBumper, yBumper, -zBumper, 0.0f,	// v7
-				-xBumper, yBumper, zBumper, 0.0f,	// v8
-				-xBumper, yBumper, -zBumper, 0.0f,	// v9
+				xBumper, yBumper, -zBumper, 0.0f,	// v6
+				xBumper, yBumper, zBumper, 0.0f,	// v7
+				-xBumper, yBumper, -zBumper, 0.0f,	// v8
+				-xBumper, yBumper, zBumper, 0.0f,	// v9
 
-				xRoofFront, yRoof, zRoof, 0.0f,		// v10
-				xRoofFront, yRoof, -zRoof, 0.0f,	// v11
-				xRoofBack, yRoof, zRoof, 0.0f,		// v12
-				xRoofBack, yRoof, -zRoof, 0.0f,		// v13
+				xRoofFront, yRoof, -zRoof, 0.0f,		// v10
+				xRoofFront, yRoof, zRoof, 0.0f,	// v11
+				xRoofBack, yRoof, -zRoof, 0.0f,		// v12
+				xRoofBack, yRoof, zRoof, 0.0f,		// v13
 
-				xDoorFront, yDoor, zDoor, 0.0f,		// v14
-				xDoorFront, yDoor, -zDoor, 0.0f,	// v15
-				xDoorFront, -yDoor, zDoor, 0.0f,	// v16
-				xDoorFront, -yDoor, -zDoor, 0.0f,	// v17
+				xDoorFront, yDoor, -zDoor, 0.0f,		// v14
+				xDoorFront, yDoor, zDoor, 0.0f,	// v15
+				xDoorFront, -yDoor, -zDoor, 0.0f,	// v16
+				xDoorFront, -yDoor, zDoor, 0.0f,	// v17
 
-				xDoorBack, yDoor, zDoor, 0.0f,		// v18
-				xDoorBack, yDoor, -zDoor, 0.0f,		// v19
-				xDoorBack, -yDoor, zDoor, 0.0f,		// v20
-				xDoorBack, -yDoor, -zDoor, 0.0f,	// v21
+				xDoorBack, yDoor, -zDoor, 0.0f,		// v18
+				xDoorBack, yDoor, zDoor, 0.0f,		// v19
+				xDoorBack, -yDoor, -zDoor, 0.0f,		// v20
+				xDoorBack, -yDoor, zDoor, 0.0f,	// v21
 			};
 
 			//
 
 			cinfo.m_yawSignCorrection = 1.0f; 
 			cinfo.m_upDirWS.set(0.0f, 1.0f, 0.0f); 
-			cinfo.m_rigidBodyForwardDir.set(1.0f, 0.0f, 0.0f); 
+			cinfo.m_rigidBodyForwardDir.set(0.0, 0.0f, 1.0f); 
 
 			cinfo.m_set[0].m_velocity = 10.0f;
 			cinfo.m_set[1].m_velocity = 50.0f;
 			// The two camera positions ("slow" and "fast" rest positions) are both the same here,
 			// -6 units behind the chassis, and 2 units above it. Again, this is dependent on 
 			// m_chassisCoordinateSystem.
-			cinfo.m_set[0].m_positionUS.set( -10.0f, 2.0f, 0.0f); 
-			cinfo.m_set[1].m_positionUS.set( -16.0f, 2.7f, 0.0f); 
+			cinfo.m_set[0].m_positionUS.set( 0, 2.0f, -10.0f); 
+			cinfo.m_set[1].m_positionUS.set( 0.0f, 2.7f, -16.0f); 
 
-			cinfo.m_set[0].m_lookAtUS.set ( 2.0f, 0.5f, 0.0f );
-			cinfo.m_set[1].m_lookAtUS.set ( 2.0f, 0.5f, 0.0f );
+			cinfo.m_set[0].m_lookAtUS.set ( 0.0f, 0.5f, 2.0f );
+			cinfo.m_set[1].m_lookAtUS.set ( 0.0f, 0.5f, 2.0f );
 
 			cinfo.m_set[0].m_fov = 60.0f;
 			cinfo.m_set[1].m_fov = 60.0f;