[SOLVED] Jumping/Impulse with momentum using nodes


#21

Velocity -> https://en.wikipedia.org/wiki/Velocity
Impulse -> https://en.wikipedia.org/wiki/Impulse_(physics)


#22

@BlackGoku36 @Armored_Blob Cheers to you both, I think a simple take away in terms of using Armory3D (for anyone else reading) is that using the “Apply Impulse” node for both moving and jumping allows for a nice momentum based jump, while using “Set Velocity” for either/or both doesn’t allow for such a natural momentum based jump.

And the “Get Transform” and “Vector From Transform” nodes should be avoided if you want any natural/non animation based physics.


#23

Good to know this is solved.


#24

I wouldn’t say that you can’t use set velocity for natural, physics based movements. It’s more that you have to be careful to avoid accidentally setting any of the 3 axis’ velocity to zero.

So, for example, you could get the objects velocity, turn it into a vector and then on moving/jumping add a new vector (with the direction of movement desired) and then set that as the new velocity. The trick is adding the new vector to the current velocity, rather using it to replace the current velocity.

Does that make sense?


#25

I think I need to do some reading about the principles of force, velocity and impulse I appreciate the help tho.

I also wonder for a controllable human character if using impulse/velocity or force to make them run is a good idea, that seems more suited to a vehicle. Perhaps just using impulse for the jump is a better idea.


#26

I ended up trying that bool, branch, impulse node setup it works well , a good way to do a physics based jump with a simple transate movement system, thanks.


#27

I have spent a while ( the last week maybe ) trying to put together a player controller for a 3rd/1st person shooter type game and it is actually pretty difficult to get it walking around the environment and getting it to walk up and down hills at the right speed, not walk up hill that are too steep, etc. The way I ended up implementing it was with a Haxe trait for a RigidBody and essentially setting the velocity of the object at every frame based on contacts and user input ( and maybe some ray-casts ). It was the only thing that gave control over the player and still didn’t go through walls.

When I finish it I will see about updating the Armory bundled third and first person controller scripts with it.


#29

I’ve spent more time using armory and now better understand how vectors work in relation to impulse, velocity and force. I made a little game from scratch with a static camera and it works as expected.

But the game really want to make has a rotating camera, a third person action game. I can’t use simple X and Y vectors as vectors change every time the camera turns. How can I make an impulse jump forwards (ie. in the direction the character/camera is facing) using my current setup? Everything else is working as expected, it’s just the direction of the jump when I’m also holding the w key.


#30

Two suggestions off the top of my head. The translate along local axis node and the character and camera nodes from the logic pack. I think they at least lead to what you are looking for.


#31

I’m already using translate on local axis for normal movement but i want to use impulse to jump, it does work but the X and Y vectors don’t relate to the camera/player rotation so it jumps in a certain direction regardless of the camera/player rotation.

I just want to grab the current X and Y vectors from the camera, The definition of the get rotation node is : “Outputs the current rotation of the set Object as a Vector.”

https://armory3d.org/manual/#/logic_nodes/reference?id=get-rotation


#32

Check out the Vector From Transform node. You can get a vector representing the objects look direction. Then, if you wanted to have something move in the look direction, you can use the Vector Math node to multiply the Look direction by the speed you want it to move in that direction.


[Solved] How To Jump in the Direction of the Camera
#33

Thanks that sounds promising.


#34

Awesome thanks, vector from transform > look did the trick, this node setup jumps forward in relation to the camera/player.