-
-
Notifications
You must be signed in to change notification settings - Fork 183
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
Add utility to get/set ex.Vector size #1277
Comments
Hi, I'd like to work on this issue. |
@saahilk All yours! I've added the community in-progress label for you |
@eonarheim Alright let me get started then! |
@eonarheim Is there a doc where I can find how to setup the environment? I only found this. Also could you point me to the files I should look through to get started on this issue specifically? |
@saahilk Let me know if this doesn't cover everything https://github.com/excaliburjs/Excalibur#environment-setup, please let me know if there are any gaps in the readme 👍 |
We'll want to fix the readme if any steps are ambiguous, missing, wrong, or poorly written |
@eonarheim Alright. Thanks! |
@eonarheim Hi which files do I look at to start with? |
Hi @saahilk Check out |
@eonarheim Do I keep the existing magnitude function marking it as obsolete or just remove it adding the size() function? |
Good question, lets keep the existing magnitude function with an |
…or size.\n Marked existing magnitude function as obsolete.\n Updated changelog.\nResolves: excaliburjs#1277
Hi @eonarheim I've submitted an initial pull request with some changes. Let me know if there's anything else that needs to be changed. |
Hi @eonarheim the comments in the usage you have mentioned in the above issue is incorrect. When you set vel.size=13 the unit vector is (0.6, 0.8) and the scaled vector will be (7.8, 10.4) and not (5, 12). |
@saahilk Good find! I was trying to do math in my head when writing the issue and failed oops! |
@eonarheim Could you check the modified pull request here. |
Context
It would be useful to set the magnitude of a vector, this allows easy scaling or capping at a maximum value. This is especially useful in physics simulations.
Proposal
I propose something like the following (there is probably a more efficient method of changing the size of the vector)
Usage:
The text was updated successfully, but these errors were encountered: