Not sure how to use physics

I’m trying to make a 3rd person game but I’m not sure how to use physics the way i want. I think i understand everything in the “Hello Physics” tutorial.



I want to have a character with very simple movement just like at 0:41 in this video: http://www.youtube.com/watch?v=Ar1QhVFyZRY



I have a PhysicsNode and the best thing i could come up with was setLinearVelocity. I also have no idea how to rotate it and make it go forward after the rotation.

It has a SphereCollisionShape so it’s spins around when i move it which i dont want.



I started with physics today and in the past 2 days I’ve been learning blender and checking the beginner tutorials in the wiki.

This it what I’ve made so far: http://i.imgur.com/arMST.jpg :smiley: It has a walk-animation too.

All the examples from the video are available as code, just create a new JmeTests project and look at the code / run the examples

If you’re simply not grasping the concepts of the tutorials that indicates you are trying to move ahead a bit too quickly. You seem to be learning a lot of new things simultaneously, and at an impressive pace at that, but might I suggest you leave physics be for a while, and try accomplish something that you know how to do, but haven’t put into practice yet?

That might be a good idea erlend_sh. I’ll take a look at the examples as normen said and if i find it too hard I’ll do something without physics.



And yes, I am learning quite a lot of new things simultaneously :slight_smile: I’ve been working with java for a little more then a year and i experimented a little with jMonkeyEngine half a year ago and i decided to start learning it again just 3 days ago. And because of that I’m familiar with the basics and learn faster.

5 hours later: It works great :smiley: I learned from the TestWalkingChar.java example (the one in the video) as you said normen.



My character is a PhysicsCharacterNode and you move it with WASD and the camera works like this:

[java]Vector3f pL = playerPhys.getWorldTranslation();

cam.setLocation(new Vector3f(pL.x+1, pL.y+7, pL.z+10));

cam.lookAt(playerNode.getWorldTranslation(), Vector3f.UNIT_Y);[/java]

The animations works fine too and the character look at the direction he is moving. And if he falls of he starts spinning around and the camera stops following him.



Screenshot: http://i.imgur.com/Ilvkj.jpg

Download: http://dl.dropbox.com/u/7999872/javaprogram/BallGuy.rar

(Uploaded it for my friends to test so might as well add the link here.)



I don’t know your policy about double-posting. Tell me if it’s not allowed and I’ll edit my previous posts in the future.

Glad to hear it worked out :slight_smile: