Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ISN 2022-ACL project Cyberpac 2077
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
RICHARD Florian
ISN 2022-ACL project Cyberpac 2077
Commits
25da80a4
Commit
25da80a4
authored
2 years ago
by
Azurlors
Browse files
Options
Downloads
Patches
Plain Diff
Collisions update
parent
98a05832
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
MAVENProject/src/main/java/environnement/HitBox.java
+11
-19
11 additions, 19 deletions
MAVENProject/src/main/java/environnement/HitBox.java
with
11 additions
and
19 deletions
MAVENProject/src/main/java/environnement/HitBox.java
+
11
−
19
View file @
25da80a4
...
@@ -45,27 +45,19 @@ public class HitBox {
...
@@ -45,27 +45,19 @@ public class HitBox {
return
(
int
)
defaultUnit
;
return
(
int
)
defaultUnit
;
}
}
public
static
Boolean
collision
(
HitBox
A
,
HitBox
B
){
// lignes sautées pour raison de lisibilité
public
static
HashMap
<
String
,
Boolean
>
collision
(
HitBox
A
,
HitBox
B
){
// lignes sautées pour raison de lisibilité
HashMap
<
String
,
Boolean
>
map
=
new
HashMap
<>();
return
(!(
A
.
extremites
.
get
(
"HautGauche"
).
getX
()
>=
B
.
extremites
.
get
(
"HautDroite"
).
getX
()))
// A est à droite de B
Boolean
a
=
!(
A
.
extremites
.
get
(
"HautGauche"
).
getX
()
>=
B
.
extremites
.
get
(
"HautDroite"
).
getX
());
// A est à droite de B
&&
(!(
A
.
extremites
.
get
(
"HautDroite"
).
getX
()
<=
B
.
extremites
.
get
(
"HautGauche"
).
getX
()))
// A est à gauche de B
Boolean
b
=
!(
A
.
extremites
.
get
(
"HautDroite"
).
getX
()
<=
B
.
extremites
.
get
(
"HautGauche"
).
getX
());
// A est à gauche de B
&&
(!(
A
.
extremites
.
get
(
"HautGauche"
).
getZ
()
>=
B
.
extremites
.
get
(
"BasGauche"
).
getZ
()))
// A est en dessous de B
Boolean
c
=
!(
A
.
extremites
.
get
(
"HautGauche"
).
getZ
()
>=
B
.
extremites
.
get
(
"BasGauche"
).
getZ
());
// A est en dessous de B
&&
(!(
A
.
extremites
.
get
(
"BasGauche"
).
getZ
()
<=
B
.
extremites
.
get
(
"HautGauche"
).
getZ
()));
// A est au dessus de B
Boolean
d
=
!(
A
.
extremites
.
get
(
"BasGauche"
).
getZ
()
<=
B
.
extremites
.
get
(
"HautGauche"
).
getZ
());
// A est au dessus de B
map
.
put
(
"collision_gauche"
,
a
);
map
.
put
(
"collision_droite"
,
b
);
map
.
put
(
"collision_bas"
,
c
);
map
.
put
(
"collision_haut"
,
d
);
return
map
;
}
}
public
HashMap
<
String
,
Coordonnees
>
getExtremites
()
{
public
HashMap
<
String
,
Coordonnees
>
getExtremites
()
{
return
extremites
;
return
extremites
;
}
}
public
static
Boolean
collisionDroite
(
HitBox
A
,
HitBox
B
){
return
!(
A
.
extremites
.
get
(
"HautGauche"
).
getX
()
>
B
.
extremites
.
get
(
"HautDroite"
).
getX
());
// A est à droite de B
}
public
static
Boolean
collisionGauche
(
HitBox
A
,
HitBox
B
){
return
!(
A
.
extremites
.
get
(
"HautDroite"
).
getX
()
<
B
.
extremites
.
get
(
"HautGauche"
).
getX
());
// A est à gauche de B
}
public
static
Boolean
collisionBas
(
HitBox
A
,
HitBox
B
){
return
!(
A
.
extremites
.
get
(
"HautGauche"
).
getZ
()
>
B
.
extremites
.
get
(
"BasGauche"
).
getZ
());
// A est en dessous de B
}
public
static
Boolean
collisionHaut
(
HitBox
A
,
HitBox
B
){
return
!(
A
.
extremites
.
get
(
"BasGauche"
).
getZ
()
<
B
.
extremites
.
get
(
"HautGauche"
).
getZ
());
// A est au dessus de B
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment