Skip to content

Lecture14のレーザーの当たり判定 #19

@Bunny63857

Description

@Bunny63857

#問題
Laserクラスの衝突判定部分について
現状だとparallelVectorの値が正でも負でも当たり判定をしてしまうため、プレイヤーがレーザーの後ろに回り込んだ場合も当たり判定をしてしまう。

#解決方法
内積からプレイヤーとレーザーの位置関係を判定して、正の場合のみ当たり判定を行うようにする
float hantei = asd.Vector2DF.Dot(destDirection, direction);
if (hantei>0){
player.OnCollide(null);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions