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

FirstPersonController.hx anti chess fool cheat. #2509

Merged
merged 2 commits into from
Jul 4, 2022
Merged

FirstPersonController.hx anti chess fool cheat. #2509

merged 2 commits into from
Jul 4, 2022

Conversation

e2002e
Copy link
Contributor

@e2002e e2002e commented Jun 27, 2022

The first controller node allows player to walk faster when using a combination of two keys,
because vectors are added as is without modifications ; I changed the code to get the correct speed. Also sped up the movement overall.

@MoritzBrueckner
Copy link
Collaborator

MoritzBrueckner commented Jul 2, 2022

Thanks! Is there a reason for not simply normalizing the dir vector after the directional components have been set? It looks like all this math can be avoided by that, but maybe I just don't understand what you try to achieve.

Also, please make sure to use tabs instead of spaces :)

@MoritzBrueckner MoritzBrueckner added the Release Notes: Fixes A pull request that fixes something. Used to generate release notes. label Jul 2, 2022
@e2002e
Copy link
Contributor Author

e2002e commented Jul 3, 2022

You can't avoid using geometry in the circle in this case;
adding the same force on X and Y does reach the corner of a square, which is the hypotenuse and bigger that going in one single direction.
By using sin/cos we can calibrate the speed to be always the same regardless of pressing one or two keys.

@QuantumCoderQC
Copy link
Contributor

What @MoritzBrueckner means is that if the direction/force vector is normalized, it always lies on the circle. No need to use polar coordinate system.

image

@e2002e
Copy link
Contributor Author

e2002e commented Jul 3, 2022

I thought normalizing was scaling a value in the range 0-1
I tried to do as you said and (to my surprise) it acts just like my complex script.
Also fixing an issue that the player had to first look in some direction to make the solution effective.

@MoritzBrueckner
Copy link
Collaborator

Normalizing a vector always sets its length to 1 (so it lies on the unit circle) while keeping the direction. The vector is divided by its length.

It looks like you accidentally pushed a commit related to the water shader to this PR, maybe you can revert that (after saving it of course!) and then optionally squash the commits starting from that commit so that the history is clean?

@e2002e
Copy link
Contributor Author

e2002e commented Jul 3, 2022

Sorry about that squash I really did not get this thing, anyway the water is set back as original, I'm trying to get it to reflect as if it was part of the ssr pass, no luck until now.

@luboslenco luboslenco merged commit 7dc0cbf into armory3d:main Jul 4, 2022
@luboslenco
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release Notes: Fixes A pull request that fixes something. Used to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants