Controll npc's using coordinates instead of force

majc

15-03-2010 10:47:48

Hi,

There is any way to control an npc with a physical body with coordinates instead of applying forces?
I'm asking this because i'm using forces but when the npc turns its not a smoth movement, i think something like setPositionOrientation gives more control, but it seems that don't work very well.
Is there another way?

PJani

15-03-2010 18:30:30

PlayerController?

majc

15-03-2010 22:53:45

No NPC (Non Player Character).

PJani

16-03-2010 08:28:38

Its the same thing. You can thread NPCs as players, but controllable by AI. If it says PlayerController it doesn't actually mean you need that use for player. You can use PlayerControllerJoint for every character in game. :D

You can set forward speed and side speed and angle, i don't see any problem why not to use PlayerController.

Just give it a try. :D

majc

16-03-2010 09:28:49

Ah ok thank you very mutch, i thought player controller only could be used on the cam.
Only yesterday i compiled OgreNewt 2.0 i don't know very well the library yet.

koirat

16-03-2010 13:15:53

I would stick with forces.
You can do with them as good as with orientations and velocities.
There are equations that allows you to calculate how much force you need to add to the body to get a desired result in a given time.
You can even do a constant velocity jump or fall with forces.

PJani

16-03-2010 13:54:40

I dont use player controller to, its to "basic".
I will soon try to combine ragdoll with animation, kinematic controller, inverse kinematics, but thats very far from real implementation, i am currently working on MultiBodyVehicle with some very complex stuff, (slip, locked , basic) differentials and "real" (petrol, diesel) engine, and some basic joint problems.

majc

16-03-2010 14:35:48

Very nice :) when you finish post here i want to try it because my game will have vehicles.
Keep your nice work we need more people like you.
Koirat do you have that equations? I'm using some of them but the NPC movements aren't very realistic, i'm at work i don't have them here, when i return home i will paste my code here :s

PJani

17-03-2010 06:17:23

meybe you are looking for this thing.

//! calculate force needed for given velocity
Ogre::Vector3 Body::calculateInverseDynamicsForce(Ogre::Real timestep, Ogre::Vector3 desiredVelocity);


Anyway i am very long way from finished with my engine and differential. I will prerelease MultiBody Vehicle Joint, and will release performance grapher when i checkout from svn and make it work with latest OgreNewt.

kallaspriit

21-03-2010 10:56:23

If you can get these to work and perhaps make a demo for it, I would be glad to add it to OgreNewt repository :)

PJani

23-03-2010 20:06:08

I will try to make demos, but now they gave us so much home work i cant see my self out of it. Damn bolonian study.