How can i move an character to specific location?

I have few model randomly created in game and i want them to move to specific location.
How can i make it happen?

http://wiki.jmonkeyengine.org/doku.php/jme3#tutorials_for_beginners

2 Likes

i think you did’t get me. I want to know if there is a method for make character move to specific location that i give or i have to develop algorithm for it?

I think I got you and its all described in the tutorials.

I’m trying to learn the engine by writing a game, so, i wouldn’t ask in here if i had find in tutorials. Just tell me how to do instead of giving me a link that i already know.

We had no evidence that you did the tutorials. Indeed, we had pretty good evidence that you probably didn’t.

Nor was your question complete enough to answer, really. Since the simple answer that 100% answers the question as asked is:
Use character.setLocalTranslation(location)

We can only answer the questions that are asked.

1 Like

Maybe you can explain why the specific tutorials that cover this (that you already read) didn’t provide you with the answers you needed. That would help narrow it down.

Hehe, you have a funny approach to making people help you, did it ever work?

are you guys kids or just drunk? did you really read what i’ve write? i’m asking to you; there is bunch of mobs that randomly spawning in game, and i want them to walk to a location that i give.
I have no idea how can i make this question more clear for you.
I’m asking a question to you and you are giving me link of tutorial, btw i didn’t even say, i wrote those. If you can’t understand people those are beginners and if you don’t know how to read, you should’t even guide them.

if you are going to write another stupid thing just delete the freaking topic.

This is the first mention of “walk” in this whole thread. This is EXTREMELY useful information. You understand that “move an object to a location” is different than “make an object walk to a location”, right?

No one ever said you wrote the tutorials… but you said you read them.

There are some that cover this so I wondered which parts of them didn’t provide you the answers you needed. That’s much easier than us guessing which part of the tutorials confused you and/or writing the whole solution for you.

Note: “I couldn’t find the tutorials that covered this” is a perfectly valid response… but that’s not quite what you said.

As a beginner, it is really in your best interest to DO all of the tutorials. Don’t just glance through the titles and hope for the best. You will learn a lot by going through them for real and they are an extremely valuable resource.

This is what you should have included in your very first post, by the way.

Okay… Whatever, so, is there any method in the engine that makes character walk into specific location?

I could give you the lazy answer (basically, attaching a CharacterControl, plus controlling the animation for bonus points), but it may or may not suit your needs.
The problem is that then you will ask how to make a character stop, or jump, or why other weird things are happening; basically wasting everyone’s time (mostly yours).

Or, you could run all the tutorials (really: all of them!) and find yourself the knowledge to do exactly the stuff you want to do, plus a lot more. It’s not that we don’t want to help you; it’s that if you don’t do the tutorials you are doing yourself a big disservice.

Finally, if you are feeling adventurous (and you should!) you can check out my RedMonkey tutorial RedMonkey tutorial
:smile:

I’ve quick looked tutorials and read half of the book i know how to make character jump and stuff. I just want to know if i can give character location instead of giving it direction.

1°) Create your character. (A spatial ? A node ? What does that mean anyway…)

Spatial ninja = assetManager.loadModel("Models/Ninja/Ninja.mesh.xml");

2°) Set the translation to be at the position you want. ( Why this idiot can’t ‘walk’ here by himself ! )

ninja.setLocalTranslation(0.0f, 10f, -2.0f);

3°) Copy Pastarino the codo of CharacterControlo and here you go !

(If you want your character to go to a specific location look at normen SDK tutorial he does that with Quixote our savior jME SDK Usecase Demo 1 - YouTube)

No… because it’s extremely implementation specific.

Is your game world a physics control world? Does your game world have a walk mesh? Should objects be avoided? What algorithm should be used for path finding? Should the animations change as the player turns?

All of these questions mean that a general solution cannot exist so the engine doesn’t include one. Just like there is no “Make MMO” button. And before you think I’m being facetious, a “walk to this location” method is closer to a “Make MMO” button than not when you factor in all that it would have to do and be aware of to be implemented properly.

However, today was released something that could be a good approximation of a “Make RTS” button :smile:

I’m not saying there has to be. However there is lookat() method, so i simply thought there might be a method like walktothere() or walktowhereyouarelooking()

But whatever you’ve said no. So i’m gonna make my own method. Thx for answer…

There is an interpolate method that will help you move from where your character is to a position where it needs to go. You should give it a try.

And that method is?

from the javadoc:

interpolate vector3f

either is fine depending on what you need