Character movement

Started by Pan83, January 15, 2007, 01:11:59 PM

Previous topic - Next topic

Pan83

Hi!!!

I have been doing a 3d project during last months.I have been using c++ 3d engines but I don't like c++.

So I found this great engine!!!

My objective is to make two characters move following two splines.In addition I need to make my camera  follow a spline and make it look at a spline path too.

Can it be done with jPCT???

Thanks

halcor

Sure. Check the documentation and the example programs.

Pan83

Quote from: "halcor"Sure. Check the documentation and the example programs.

Thanks for the quick reply!!!

Are there any newbie tutorials available??

Thanks

Melssj5

Well, there isnt a newbie tutorial, but you can ask whatever you need but be specific, dont say: please can anyone make a tutorial just for me?

but you can ask about specific things like the spilines!

Once I remember a guy that was asking about a tutorial and he was hard to explain things, you may found that thread on which are exaplined some initial stuff about the engine.
Nada por ahora

EgonOlsen

Here's a thread with a simple "Hello World"-application: http://www.jpct.net/forum/viewtopic.php?t=579
I'm not sure if the last version posted is a working one but the one he's linking to should work.

Pan83

Thanks for info.

The hello world app was very helpful.

I am checking the manual and the javadoc now to learn the engine.

I will be back for questions for sure... :)  :)

Thanks again

Pan83

I have a md2 character and I will use Animation so it can follow a path.

How can I make the md2 face the direction it's moving?

Thanks

EgonOlsen

If you have the direction vector, you can derive a rotation matrix from this and set it as the new rotation matrix to the Object3D. Somehow like this:


Matrix tar=dirVec.getRotationMatrix();
enemy.setRotationMatrix(tar);

Pan83

Thanks for help EgonOlsen but I am totally lost  :cry:

I want to make my md2 to follow this simple path

(0, 0,200)->(-200, 0,0)->(0, 0,-200)->(200, 0,0) using a simple spline(there are some types in Animation I have seen) but I can't make it.

Can you help?I would be very gratefull!!!

EgonOlsen

You have to calculate the positions in between, i.e. if you are at (0,0,200)=vt1 at time t1=0 and at (-200,0,0)=vt2 at time t2=1000, you are at (-1,0,199)=vt at time t=10 (for example). So if you are at t=10 in this example and your last position was vt1, your direction vector is vd=vt-vt1=(-1,0,-1). Then you would do (assuming that your last translation placed you at vt1):


obj.translate(vd);
obj.setRotationMatrix(vd.getRotationMatrix());


How to get the steps in between?...i don't know much about splines, but it has to be possible somehow... :wink:

cyberkilla

Perhaps you could get the distance form one point to the other,
and create an array of inbetween coords.

You know that x,y,z difference can be found between the two points.

If you divided each one by, for example, 5, then you made an array out of each
coord+(i*5), you could get inbetween points?

Not real code btw...

//Need to be filled with start and end point.
Point3D start;
Point3D end;

//Stores the inbetween coordinates?
Point3D inbetweenCoords = new Point3D(5);

//The difference between coords.
float xDiff = start.x - end.x;
float yDiff = start.y - end.y;
float zDiff = start.z - end.z;

//The distance between each inbetween point.
float xInc = xDiff/5;
float yInc = yDiff/5;
float zInc = zDiff/5;

//Loop through, creating inbetween points.
int i=0,num=5;
while(i<num)
{
    inbetweenCoords[i] = new Point3D(start+(xInc*i),start+(yInc*i),start+(zInc*i));
    i++;
}


That might not work right away, but if you need inbetween coords, it seems to be like itis a starting point. I know Ill be looking into this myself:)
http://futurerp.net - Text Based MMORPG
http://beta.rpwar.com - 3D Isometric MMORPG