-
Notifications
You must be signed in to change notification settings - Fork 74
Added core_3d_camera_fps.odin example #129
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi. Thanks for the PR.
There are a bunch of unnecessary type specifications that I think came along from the C code. Such as this:
hvelLength: f32 = rl.Vector3Length(hvel)
Just use hvelLength := rl.Vector3Length(hvel)
Also, there is some weird "type double dipping" happening, such as this:
desiredDir: rl.Vector3 = rl.Vector3 {
Just do
desiredDir := rl.Vector3 {
I've only given a comment once for a specific issue, but most of them happen multiple times, so please look through the file.
Also, I've set up a style guide for the examples repository. Future PRs will have it linked in the template: https://github.com/odin-lang/examples/wiki/Naming-and-style-convention
} | ||
} | ||
|
||
TOWER_SIZE: rl.Vector3 : rl.Vector3{16.0, 32.0, 16.0} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TOWER_SIZE :: rl.Vector3{16.0, 32.0, 16.0}
} | ||
} | ||
|
||
delta: f32 = rl.GetFrameTime() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use type inference delta := rl.GetFrameTime()
body.velocity.y -= GRAVITY * delta | ||
} | ||
|
||
if (body.isGrounded && jumpPressed) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra parens
// Draw game level | ||
draw_level :: proc() { | ||
FLOOR_EXTENT: int : 25 | ||
TILE_SIZE: f32 : 5.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just do TILE_SIZE :: 5
. It'll implicitly cast correctly when you use it.
lookRotation.x -= mouseDelta.x * sensitivity.x | ||
lookRotation.y += mouseDelta.y * sensitivity.y | ||
|
||
sideway := i8(i8(rl.IsKeyDown(.D)) - i8(rl.IsKeyDown(.A))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both are i8
. The outer cast does nothing.
Added core_3d_camera_fps.odin example which is based on raylib core_3d_camera_fps.c.
The original c example is playable here .
Checklist before submitting:
.github/workflows/check.yml
(for automatic testing)-vet -strict-style -vet-tabs -disallow-do -warnings-as-errors
core
naming convention: https://github.com/odin-lang/Odin/wiki/Naming-Convention (exception can be made for ports of examples that need to match 1:1 to the original source).