English 中文(简体)
发动机-防止汽车碰撞,预见碰撞
原标题:AndEngine - prevent car collision, foresee collision
  • Im building a car-traffic game, where the player will drive car avoiding collision the bot car should not collide with each other.
  • i have a update handler for each car that drives the car at varying speeds, but i cant think of a code that could predict a future collision with fellow bot car without actual collsion..
  • what my code should do is check for collision with the car before the current car so that it could change lanes to prevent collision
    any ideas im new to andengine
问题回答

你可以使用一个传感器主体在实际汽车前方检查其碰撞情况,然后当传感器主体发生碰撞时,汽车将防止碰撞。当然,之后你必须重置传感器,我相信一定有一个更优雅的解决方案。因此,我将把这个问题转移到Stack Exchange的游戏开发部门,那里的人对这类问题更有经验。

这是一个人工智能问题,你实际上不需要预测碰撞。你只需要一套汽车遵循的规则,让它们避免碰撞。试着弄清楚你是如何避免交通中的碰撞的。然后将这些规则应用于您的汽车。说起来容易做起来难。

例如,如果我开得比前面的车快,而且靠得太近,我应该换车道或减速。要编程,你可以检查两辆车之间的距离,找出后面的车是否比前面的车行驶得更快。如果是这样,请降低车速或尝试变道。

不要试图预测碰撞是否会发生。这很难,更难弄清楚正确的反应。

最简单的方法是使用光线投射(或几个光线投射)来检测汽车在特定方向上的给定范围内是否有任何东西。





相关问题
Collision Detection between Accelerating Spheres

I am writing a physics engine/simulator which incorporates 3D space flight, planetary/stellar gravitation, ship thrust and relativistic effects. So far, it is going very well, however, one thing that ...

Triangle - Triangle Intersection Test

I d like to know if there is out there some tutorial or guide to understand and implement a Triangle-Triangle intersection test in a 3D Environment. (i don t need to know precise where the ...

Simple Problem - Velocity and Collisions

Okay I m working on a Space sim and as most space sims I need to work out where the opponents ship will be (the 3d position) when my bullet reaches it. How do I calculate this from the velocity that ...

OO design and mirrored/duplicated methods

I m having an issue in OO design where I end up with duplicate code in 2 different classes. Here s what s going on: In this example, I want to detect collision between game objects. I have a base ...

avoiding geocode range collisions

I am in the process of extracting location entities ( Madison Square Garden , San Diego Zoo , etc.) from a large table of non-uniform location. I m trying to avoid multiple entities in my new table. ...

Bounding ellipse

I have been given an assignement for a graphics module, one part of which is to calculate the minimum bounding ellipse of a set of arbitrary shapes. The ellipse doesn t have to be axis aligned. This ...

circle-circle collision

I am going to develop a 2-d ball game where two balls (circles) collide. Now I have the problem with determining the colliding point (in fact, determining whether they are colliding in x-axis/y-axis)....

热门标签