parent
0cf0002c08
commit
3898678e76
@ -40,6 +40,7 @@
|
||||
#include "karts/skidding.hpp"
|
||||
#include "modes/linear_world.hpp"
|
||||
#include "modes/profile_world.hpp"
|
||||
#include "physics/triangle_mesh.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
#include "tracks/drive_graph.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
@ -911,8 +912,15 @@ bool SkiddingAI::steerToAvoid(const std::vector<const Item *> &items_to_avoid,
|
||||
const Vec3& left = items_to_avoid[index_left_most]->getXYZ();
|
||||
int node_index = items_to_avoid[index_left_most]->getGraphNode();
|
||||
const Vec3& normal = DriveGraph::get()->getNode(node_index)->getNormal();
|
||||
Vec3 hit;
|
||||
Vec3 hit_nor(0, 1, 0);
|
||||
const Material* m;
|
||||
m_track->getPtrTriangleMesh()->castRay(
|
||||
Vec3(line_to_target.getMiddle()) + normal,
|
||||
Vec3(line_to_target.getMiddle()) + normal * -10000, &hit, &m,
|
||||
&hit_nor);
|
||||
Vec3 p1 = line_to_target.start,
|
||||
p2 = line_to_target.getMiddle() + normal.toIrrVector(),
|
||||
p2 = line_to_target.getMiddle() + hit_nor.toIrrVector(),
|
||||
p3 = line_to_target.end;
|
||||
|
||||
int item_index = -1;
|
||||
@ -929,12 +937,6 @@ bool SkiddingAI::steerToAvoid(const std::vector<const Item *> &items_to_avoid,
|
||||
else
|
||||
{
|
||||
const Vec3& right = items_to_avoid[index_right_most]->getXYZ();
|
||||
int node_index = items_to_avoid[index_right_most]->getGraphNode();
|
||||
const Vec3& normal = DriveGraph::get()->getNode(node_index)->getNormal();
|
||||
Vec3 p1 = line_to_target.start,
|
||||
p2 = line_to_target.getMiddle() + normal.toIrrVector(),
|
||||
p3 = line_to_target.end;
|
||||
|
||||
if (right.sideofPlane(p1, p2, p3) >= 0)
|
||||
{
|
||||
// Right of rightmost point
|
||||
|
@ -40,6 +40,7 @@
|
||||
#include "karts/skidding.hpp"
|
||||
#include "modes/linear_world.hpp"
|
||||
#include "modes/profile_world.hpp"
|
||||
#include "physics/triangle_mesh.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
#include "tracks/drive_graph.hpp"
|
||||
#include "tracks/track.hpp"
|
||||
@ -917,8 +918,15 @@ bool SkiddingAI::steerToAvoid(const std::vector<const Item *> &items_to_avoid,
|
||||
const Vec3& left = items_to_avoid[index_left_most]->getXYZ();
|
||||
int node_index = items_to_avoid[index_left_most]->getGraphNode();
|
||||
const Vec3& normal = DriveGraph::get()->getNode(node_index)->getNormal();
|
||||
Vec3 hit;
|
||||
Vec3 hit_nor(0, 1, 0);
|
||||
const Material* m;
|
||||
m_track->getPtrTriangleMesh()->castRay(
|
||||
Vec3(line_to_target.getMiddle()) + normal,
|
||||
Vec3(line_to_target.getMiddle()) + normal * -10000, &hit, &m,
|
||||
&hit_nor);
|
||||
Vec3 p1 = line_to_target.start,
|
||||
p2 = line_to_target.getMiddle() + normal.toIrrVector(),
|
||||
p2 = line_to_target.getMiddle() + hit_nor.toIrrVector(),
|
||||
p3 = line_to_target.end;
|
||||
|
||||
int item_index = -1;
|
||||
@ -935,12 +943,6 @@ bool SkiddingAI::steerToAvoid(const std::vector<const Item *> &items_to_avoid,
|
||||
else
|
||||
{
|
||||
const Vec3& right = items_to_avoid[index_right_most]->getXYZ();
|
||||
int node_index = items_to_avoid[index_right_most]->getGraphNode();
|
||||
const Vec3& normal = DriveGraph::get()->getNode(node_index)->getNormal();
|
||||
Vec3 p1 = line_to_target.start,
|
||||
p2 = line_to_target.getMiddle() + normal.toIrrVector(),
|
||||
p3 = line_to_target.end;
|
||||
|
||||
if (right.sideofPlane(p1, p2, p3) >= 0)
|
||||
{
|
||||
// Right of rightmost point
|
||||
|
Loading…
Reference in New Issue
Block a user