青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

天行健 君子當自強而不息

Working with Maps and Levels(9)

Blocking the Path with Barriers

You know—detecting when your character is walking around the map bumping into walls or standing
on solid ground. What about objects such as doors blocking your character’s way?
Because a door is not part of the terrain, I didn’t include a door when I constructed
the collision detection code. Now is the time to remedy that situation.

Anything that bars clear passage of a character’s movement is called a barrier.
Barriers can exist in two states—open (disabled) or closed (enabled). Characters
are allowed to pass through a barrier when it is open, but they cannot pass through
when the barrier is closed.

You can treat barriers much as you do triggers. You can define a barrier similar to
the way you define a trigger on a map. You can define barriers as spheres, boxes,
cylinders, and triangles. Barriers can also have an enabled state, with true meaning
that the barrier is blocking the character’s passage and false meaning that the way
through the barrier is clear.

The big difference between barriers and triggers is that barriers can have meshes
and animation assigned to them. This relieves you of the burden of drawing the
barrier and gives the job to the barrier engine. All you have to do is assign the
meshes and animations.

You start off using barriers with the barrier class declaration,
which looks very similar to the trigger class declaration. Notice that I also
define an enum list and structure (sBarrier) used to contain each barrier’s data:

enum BarrierType
{
    BARRIER_SPHERE = 0, BARRIER_BOX, BARRIER_CYLINDER, BARRIER_TRIANGLE
};

/********************************************************************************************/

typedef 
struct sBarrier
{
    
long    type;  // BARRIER_SPHERE, BARRIER_BOX, etc.
    long    id;
    
bool    enabled;

    
float   x_pos, y_pos, z_pos;
    
float   x_rot, y_rot, z_rot;

    
float   x1, y1, z1;
    
float   x2, y2, z2;
    
float   x3, z3;

    
float   radius;

    cObject 
object;

    sBarrier*   prev;
    sBarrier*   next;

    
//////////////////////////////////////////////////////////////////////

    sBarrier()  
    { 
        prev = next = NULL; 
    }

    ~sBarrier() 
    { 
        delete next; next = NULL;  
    }
} *sBarrierPtr;

Here’s where the similarities between the triggers and barrier end. A barrier needs
a graphical representation (a 3-D mesh), so the code adds a Graphics
Core cObject object that is used to contain the barrier’s mesh and animation data.

Getting back to the similarities of the trigger and barrier classes, notice the pointers
that maintain the linked list as well as the sBarrier structure constructor and
destructor.

The similarities between triggers and barrier continue with the declaration of the
barrier class:

typedef class cBarrier
{
private:
    
long        m_num_barriers;
    sBarrier*   m_root_barrier;

    
//////////////////////////////////////////////////////////////////////

public:
    cBarrier()
    {
        m_num_barriers = 0;
        m_root_barrier = NULL;
    }
    
    ~cBarrier()
    {
        free();
    }

    
void free()
    {
        delete m_root_barrier;
        m_root_barrier = NULL;

        m_num_barriers = 0;
    }

    
long get_num_barriers()
    {
        
return m_num_barriers;
    }

    sBarrier* get_root_barrier()
    {
        
return m_root_barrier;
    }
 

Shift your focus for a moment to the arguments that the add_barrier function is taking.
Aside from the position in which to position the barrier (using the x_pos, y_pos,
and z_pos arguments), the add_barrier function takes the rotational values in which to
draw the barrier’s mesh (using the x_rot, y_rot, and z_rot arguments that represent the
X-, Y-, and Z-rotational values, in radians, respectively).

Notice that the addition of rotational values throughout the barrier class, as well as
the addition of an extra trio of coordinates that define the mesh’s position in the
world. As you come upon these additional values, I’ll be sure to point them out.

    sBarrier* add_barrier(long type, long id, bool enabled,
                          
float x_pos, float y_pos, float z_pos,
                          
float x_rot, float y_rot, float z_rot)
    {
        
// allocate a new barrier structure and link in

        sBarrier* bar = 
new sBarrier;

        bar->prev = NULL;
        bar->next = m_root_barrier;

        
if(m_root_barrier)
            m_root_barrier->prev = bar;

        m_root_barrier = bar;

        bar->type    = type;
        bar->id      = id;
        bar->enabled = enabled;
        bar->x_pos   = x_pos;
        bar->y_pos   = y_pos;
        bar->z_pos   = z_pos;
        bar->x_rot   = x_rot;
        bar->y_rot   = y_rot;
        bar->z_rot   = z_rot;

        m_num_barriers++;

        
return bar;
    }  

posted on 2007-12-10 13:50 lovedday 閱讀(189) 評論(0)  編輯 收藏 引用

公告

導航

統計

常用鏈接

隨筆分類(178)

3D游戲編程相關鏈接

搜索

最新評論

青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            久久久综合激的五月天| 久久久久久国产精品mv| 欧美激情综合色| 美日韩精品视频| 亚洲激情午夜| 99国产成+人+综合+亚洲欧美| 欧美aⅴ一区二区三区视频| 亚洲精品一区中文| 99国内精品久久| 国产亚洲欧美激情| 欧美高清视频在线观看| 亚洲综合导航| 欧美在线关看| 亚洲三级免费电影| 亚洲深夜福利网站| 有码中文亚洲精品| 亚洲美女福利视频网站| 国产婷婷97碰碰久久人人蜜臀| 免费不卡视频| 欧美三级网页| 老司机凹凸av亚洲导航| 欧美日韩激情网| 麻豆精品在线视频| 欧美视频中文在线看| 美女主播一区| 国产精品久久久久aaaa九色| 欧美99在线视频观看| 国产精品第三页| 欧美国产欧美亚州国产日韩mv天天看完整| 欧美极品影院| 麻豆精品视频| 国产精品日韩在线观看| 欧美黄色aaaa| 黄色成人在线网站| 一区二区三区www| 亚洲国产欧美一区二区三区久久 | 日韩视频一区二区三区在线播放免费观看 | 久久精品国亚洲| 欧美日韩午夜视频在线观看| 毛片av中文字幕一区二区| 欧美无乱码久久久免费午夜一区| 老司机一区二区三区| 国产精品日韩欧美大师| 亚洲精品国产精品国自产在线| 国产欧美日韩在线视频| 亚洲每日更新| 亚洲精品女人| 毛片基地黄久久久久久天堂| 久久精品一级爱片| 国产精品视频免费一区| 日韩视频欧美视频| 一区二区欧美精品| 欧美精品一区二区精品网 | 久久综合99re88久久爱| 国产精品人成在线观看免费| 99视频一区二区| 一本久道久久综合狠狠爱| 麻豆精品一区二区av白丝在线| 久久综合999| 国产一区深夜福利| 欧美一区午夜精品| 欧美在线日韩| 狠狠狠色丁香婷婷综合激情| 性欧美在线看片a免费观看| 欧美在线一二三四区| 国产精品视频久久久| 亚洲一区国产视频| 欧美一区二区三区另类| 国产精品丝袜久久久久久app| 亚洲国产清纯| 免播放器亚洲一区| 91久久久久久| 亚洲男人的天堂在线aⅴ视频| 国产精品久久久久久久久久久久 | 久久视频在线看| 伊人成年综合电影网| 蜜臀久久99精品久久久画质超高清 | 一区二区三区在线不卡| 久久久久在线| 亚洲人成绝费网站色www| 亚洲视频精品在线| 国产伦精品一区二区三区免费| 亚洲少妇自拍| 久久精品国产2020观看福利| 国产午夜久久| 免费视频一区| 亚洲少妇最新在线视频| 久久精品电影| 亚洲毛片在线观看.| 欧美日韩一区二区三区四区在线观看 | 99国产精品私拍| 欧美揉bbbbb揉bbbbb| 午夜精品久久久99热福利| 蜜臀av一级做a爰片久久| 99日韩精品| 国产一区二区高清不卡| 欧美成人中文| 亚洲欧美在线磁力| 亚洲国产欧美一区二区三区久久 | 欧美一区二区三区在线播放| 欧美激情影院| 欧美在线视频免费播放| 最新国产精品拍自在线播放| 欧美亚州韩日在线看免费版国语版| 欧美在线一二三区| 日韩一级网站| 欧美1区视频| 欧美一区二区视频在线| 亚洲精选视频免费看| 国产午夜精品理论片a级探花| 欧美精品一区二区三区蜜臀| 久久国产加勒比精品无码| 一本久久a久久免费精品不卡| 久久免费午夜影院| 亚洲欧美国产不卡| 99视频精品全部免费在线| 国内揄拍国内精品久久| 国产精品分类| 欧美日韩精品免费观看视频| 久久免费高清| 欧美在线网址| 性色av一区二区三区红粉影视| 亚洲二区在线观看| 欧美a级一区| 久久九九久精品国产免费直播| 亚洲一区二区黄色| 一区二区欧美激情| 亚洲久久在线| 亚洲精品久久久久久久久久久久久 | 欧美成人免费在线| 久久久噜噜噜| 久久精品综合网| 久久精品男女| 久久精品国产在热久久| 欧美一区二区三区在线观看| 午夜精品福利一区二区三区av| 亚洲一区二区三区在线播放| 在线日韩欧美视频| 亚洲国产99| 最新日韩在线| 亚洲精品资源| 亚洲天堂av在线免费| 亚洲视频一区二区免费在线观看| 亚洲麻豆国产自偷在线| 宅男噜噜噜66国产日韩在线观看| 99re国产精品| 亚洲一区二区三区高清| 亚洲一区二区三区激情| 性欧美video另类hd性玩具| 欧美一区二区三区视频免费| 欧美伊人久久大香线蕉综合69| 久久精品30| 免费国产一区二区| 亚洲国产精品久久久久秋霞影院 | 午夜在线观看欧美| 欧美呦呦网站| 久久一区亚洲| 欧美精品七区| 国产精品mm| 国产欧美亚洲一区| 亚洲电影激情视频网站| 99精品福利视频| 欧美一级黄色网| 蜜桃伊人久久| 夜夜精品视频| 欧美在线欧美在线| 欧美成人精精品一区二区频| 欧美日韩一区综合| 国产日韩在线一区| 亚洲国产天堂久久国产91| 亚洲视频 欧洲视频| 久久不射中文字幕| 欧美激情免费在线| 亚洲午夜激情网站| 久久久久免费| 国产精品乱看| 亚洲国产毛片完整版| 亚洲欧美国产日韩天堂区| 麻豆成人在线| 亚洲视频在线二区| 欧美大片免费观看| 国产日韩av一区二区| 99精品免费网| 久久免费视频一区| 亚洲无线一线二线三线区别av| 久久久久九九九九| 国产精品视频一二| 亚洲伦理在线免费看| 久久精品亚洲一区二区| 日韩一级在线观看| 美女尤物久久精品| 国产亚洲午夜高清国产拍精品| 99精品视频免费观看| 裸体素人女欧美日韩| 亚洲男人的天堂在线aⅴ视频| 欧美国产日韩一二三区| 黄色成人在线网址| 久久精品日韩欧美| 亚洲天堂男人| 欧美日本精品一区二区三区|