Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Bunny63857 opened this issue May 27, 2019 · 0 comments
Open

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

Bunny63857 opened this issue May 27, 2019 · 0 comments

Comments

@Bunny63857
Copy link

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant