mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 20:56:39 +00:00 
			
		
		
		
	Build straight path for wandering flying and water creatures
This commit is contained in:
		
							parent
							
								
									ebdff5d96e
								
							
						
					
					
						commit
						ff67a9e233
					
				
					 3 changed files with 20 additions and 4 deletions
				
			
		|  | @ -318,10 +318,17 @@ namespace MWMechanics | |||
|             if ((isWaterCreature || isFlyingCreature) && destinationThroughGround(currentPosition, mDestination)) | ||||
|                 continue; | ||||
| 
 | ||||
|             const osg::Vec3f halfExtents = MWBase::Environment::get().getWorld()->getPathfindingHalfExtents(actor); | ||||
|             mPathFinder.buildPath(actor, currentPosition, mDestination, actor.getCell(), | ||||
|                 getPathGridGraph(actor.getCell()), halfExtents, getNavigatorFlags(actor)); | ||||
|             mPathFinder.addPointToPath(mDestination); | ||||
|             if (isWaterCreature || isFlyingCreature) | ||||
|             { | ||||
|                 mPathFinder.buildStraightPath(mDestination); | ||||
|             } | ||||
|             else | ||||
|             { | ||||
|                 const osg::Vec3f halfExtents = MWBase::Environment::get().getWorld()->getPathfindingHalfExtents(actor); | ||||
|                 mPathFinder.buildPath(actor, currentPosition, mDestination, actor.getCell(), | ||||
|                     getPathGridGraph(actor.getCell()), halfExtents, getNavigatorFlags(actor)); | ||||
|                 mPathFinder.addPointToPath(mDestination); | ||||
|             } | ||||
| 
 | ||||
|             if (mPathFinder.isPathConstructed()) | ||||
|             { | ||||
|  |  | |||
|  | @ -269,6 +269,13 @@ namespace MWMechanics | |||
|             mPath.pop_front(); | ||||
|     } | ||||
| 
 | ||||
|     void PathFinder::buildStraightPath(const osg::Vec3f& endPoint) | ||||
|     { | ||||
|         mPath.clear(); | ||||
|         mPath.push_back(endPoint); | ||||
|         mConstructed = true; | ||||
|     } | ||||
| 
 | ||||
|     void PathFinder::buildPathByPathgrid(const osg::Vec3f& startPoint, const osg::Vec3f& endPoint, | ||||
|         const MWWorld::CellStore* cell, const PathgridGraph& pathgridGraph) | ||||
|     { | ||||
|  |  | |||
|  | @ -72,6 +72,8 @@ namespace MWMechanics | |||
|                 mCell = nullptr; | ||||
|             } | ||||
| 
 | ||||
|             void buildStraightPath(const osg::Vec3f& endPoint); | ||||
| 
 | ||||
|             void buildPathByPathgrid(const osg::Vec3f& startPoint, const osg::Vec3f& endPoint, | ||||
|                 const MWWorld::CellStore* cell, const PathgridGraph& pathgridGraph); | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue