Update sample code - Terrain Collision#144
Open
nelson-mig-l wants to merge 1 commit intojMonkeyEngine:masterfrom
nelson-mig-l:patch-2
Open
Update sample code - Terrain Collision#144nelson-mig-l wants to merge 1 commit intojMonkeyEngine:masterfrom nelson-mig-l:patch-2
nelson-mig-l wants to merge 1 commit intojMonkeyEngine:masterfrom
nelson-mig-l:patch-2
Conversation
method `setGravity` takes `float` as parameter instead of `Vector3f`
Ali-RS
reviewed
Jan 29, 2022
| // You can change the gravity of individual physics objects after they are | ||
| // added to the PhysicsSpace. | ||
| player.setGravity(new Vector3f(0,-30f,0)); | ||
| player.setGravity(-30f); |
Member
There was a problem hiding this comment.
I think gravity should be a positive value when used with setGravity(float). See this example: https://github.com/jMonkeyEngine/jmonkeyengine/blob/ec752f73b4f7b720cee1929a89d57cc1b04cf752/jme3-examples/src/main/java/jme3test/helloworld/HelloTerrainCollision.java#L159
@stephengold, am I right?
Member
There was a problem hiding this comment.
You're right, @Ali-RS. The PhysicsCharacter.setGravity(float) argument represents acceleration in the character's "down" direction, so it's usually non-negative. That's true in both Minie and jme3-jbullet.
It would be great to get all the sample code in the Wiki synched with the "jme3test.helloworld" package in jme3-examples.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
method
setGravitytakesfloatas parameter instead ofVector3f