예제 #1
0
void addWaypointInbetween()
{
	btAlignedObjectArray<Waypoint*>* wayList = entManager->getWaypointList();
	int prevIndex = getClosestWaypoint();
	if (prevIndex == -1)
		return;
	/*else if (prevIndex == wayList->size()-1)
	{
		createWaypoint();
		return;
	}*/
	Car* c = entManager->getCar(0);
	

	btTransform wayPointT1 = c->physicsObject->getWorldTransform();
	
	Waypoint* previousWay = wayList->at(prevIndex);		
	int nextIndex = previousWay->getWaypointList().at(0)->getIndex();
	previousWay->removeWaypointFromList(wayList->at(nextIndex)->getIndex());
	
	entManager->createWaypoint("model/waypoint.obj", wayPointT1);
	
	Waypoint* newWay = wayList->at(wayList->size()-1);
	if (wayList->size()>1)
	{
		previousWay->addNextWaypoint(newWay);
		newWay->addNextWaypoint(wayList->at(nextIndex));
	}
	newWay->setThrottle(controller1.getTriggers());
}
예제 #2
0
void floatingWaypoint(){
	btAlignedObjectArray<Waypoint*>* wayList = entManager->getWaypointList();
	Car* c = entManager->getCar(0);
	btTransform wayPointT1 = c->physicsObject->getWorldTransform();	
	entManager->createWaypoint("model/waypoint.obj", wayPointT1);	
	Waypoint* newWay = wayList->at(wayList->size()-1);
	newWay->setThrottle(controller1.getTriggers());
	Waypoint* prevWay = wayList->at(waypointIndex1);
	prevWay->addNextWaypoint(newWay);
	waypointIndex1 = newWay->getIndex();
}
예제 #3
0
//Dynamic creation of waypoints
void createWaypoint(){
	btAlignedObjectArray<Waypoint*>* wayList = entManager->getWaypointList();
	Car* c = entManager->getCar(0);
	//btScalar a = c->getTangent().angle(btVector3(1,0,0));
//	btTransform wayPointT1 = btTransform(btQuaternion(btVector3(0,1,0),a),entManager->getCar(0)->getPosition() + btVector3(0,3,0));
	btTransform wayPointT1 = c->physicsObject->getWorldTransform();
	//btTransform wayPointT1 = btTransform(btQuaternion(0, 0, 0, 1),entManager->getCar(0)->getPosition() + btVector3(0,3,0));
	Waypoint* previousWay;
	if (wayList->size()>0)
	{
		previousWay = wayList->at(wayList->size()-1);
		previousWay->removeWaypointFromList(wayList->at(0)->getIndex());
	}
	entManager->createWaypoint("model/waypoint.obj", wayPointT1);
	
	Waypoint* newWay = wayList->at(wayList->size()-1);
	if (wayList->size()>1)
	{
		previousWay->addNextWaypoint(newWay);
		newWay->addNextWaypoint(wayList->at(0));
	}
	newWay->setThrottle(controller1.getTriggers());
}