Algorithm: Collision Detection in motion

Source: Internet
Author: User
Tags radar

How can I detect obstacles in a game, for example, when a tank moves in a certain direction? And can be bypassed?
I remember this question on csdn. Did not take a closer look.

The simplest idea: In each exercise time unit, such as 0.1 seconds. To see if there are any obstacles to moving to the location.
There are two disadvantages: the calculation workload is relatively large & the tank is silly, not hitting the south wall and not looking back.

There is a restriction that the tank has its own visible range.

If players define their own tanks. To define unitprofileattribute {
Cost = 300; // cost
Speed = 3; // mobile intensity
Power = 3; // firepower
Powerspeed = 5; // shell speed
Defense = 100; // armor
Reloadtime = 10; // Interval
Radarrange = 100; // the performance of the above Tanks must be tested. Not worth the money
Override angle onstep (Unit me) {// the angle from which to move each time
// Look at the radar and choose to go left and right.
// You have to decide to open the fire when you discover the enemy.
}
}

This is the information unit {
Point Target; // move the target
Scaninfo radar; // Radar Information
Shot (); // fired
}

If you are interested, think about how to find the path. By default, the system may provide a stupid tank that turns left into a wall.
This very earthy framework is under construction, hoping to help ourgame.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.