Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
Projet INF443 Maé
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Noé ARTRU
Projet INF443 Maé
Commits
fa25bd96
Commit
fa25bd96
authored
1 year ago
by
Marie AUDOUARD
Browse files
Options
Downloads
Patches
Plain Diff
Add hitbox for real
parent
78e8a369
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
projet-code/scenes_inf443/base/src/hitbox.cpp
+28
-0
28 additions, 0 deletions
projet-code/scenes_inf443/base/src/hitbox.cpp
projet-code/scenes_inf443/base/src/hitbox.hpp
+16
-0
16 additions, 0 deletions
projet-code/scenes_inf443/base/src/hitbox.hpp
with
44 additions
and
0 deletions
projet-code/scenes_inf443/base/src/hitbox.cpp
0 → 100644
+
28
−
0
View file @
fa25bd96
#include
"hitbox.hpp"
bool
hitbox
::
is_in_hitbox
(
vec3
pos
)
{
for
(
int
i
=
0
;
i
<
N
;
i
++
)
{
if
(
norm
(
pos
-
pos
[
i
])
<
r
[
i
])
return
true
;
}
return
false
;
}
void
hitbox
::
initialize_bat
(
double
scale
,
vec3
posB
,
vec3
posWL
,
vec3
posWR
)
{
N
=
3
;
pos
.
resize
(
N
);
r
.
resize
(
N
);
pos
[
0
]
=
posB
;
r
[
0
]
=
1
*
scale
;
pos
[
1
]
=
posWL
;
r
[
1
]
=
0.5
*
scale
;
pos
[
2
]
=
posWR
;
r
[
2
]
=
0.5
*
scale
;
}
void
hitbox
::
update_bat
(
vec3
posB
,
vec3
posWL
,
vec3
posWR
)
{
pos
[
0
]
=
posB
;
pos
[
1
]
=
posWL
;
pos
[
2
]
=
posWR
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
projet-code/scenes_inf443/base/src/hitbox.hpp
0 → 100644
+
16
−
0
View file @
fa25bd96
#pragma once
#include
"cgp/cgp.hpp"
using
namespace
cgp
;
struct
hitbox
{
int
N
;
std
::
vector
<
vec3
>
pos
;
std
::
vector
<
double
>
r
;
void
initialize_bat
(
double
scale
,
vec3
posB
,
vec3
posWL
,
vec3
posWR
);
void
update_bat
(
vec3
posB
,
vec3
posWL
,
vec3
posWR
);
bool
is_in_hitbox
(
vec3
pos
);
};
\ 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