Look at the its way while moving

Hello all…

I did this:
when I click the left mouse button then a cube is being created and the character (eve) is moving towards it

The problem is:
how to make this character(eve) looks to its way while moving and face its own direction

I used lookAt(cube) but that doesn’t seem a good idea

Other ideas??

Thanks in advance

I didnt really understand the text, but you want to have a character look at something while moving? You can expose only the head joint (bone) and have a lookAt in a task. That way you can still have the body animated.

Assuming your tying to get the entire character to face the cube, lookAt() is the best way I know of getting one object to look at another. Can you explain what it’s doing that isn’t right? If its causing your character to look up or down, and you don’t want that, then adding setH(0) should fix that. If its something else… then I would need more information.


You may misunderstand me…like the example of pathfinding on pandaai page where you click and then the character moves towards the goal but it doesn’t look at the goal itself, it looks at the direction it goes to

When it moves to the right then its H value will be changed to make it look to the right where it directed to
I hope that clear

So your trying to get the AI char to look at the direction its walking?

I am unfamiliar with PandAI, however, I looked at the page for it, and you can probably use the aichar.getVelocity() to point your character.

not exact code but it should get the point across:
character.lookAt(characterPos + character.getVelocity())

No getVelocity for libpanda.NodePath nor for Actor
Does this means that I have to make my character a PhysicsObject?? I didn’t try it before

getVelocity wasnt for pandaNode it was for the AICharacter class, which should be what you attached to the node to make it move.

something like this was called somewhere:
aiChar = AICharacter(Character_name, model_nodepath, mass, movement_force, maximum_force)

then you need: