Quote: "Hey Xarshi, i was jsut lookign through the list of commands on the front page and saw Charecter Controller commands. What are thease commands used for(Not the obvious and what will they work like? "
I'm not quite sure I get what you are asking. Just a quick explanation of what they do collectively - lets say you want your character to move like, oh, I don't know, Halo's main character master chief. Well, he uses the exact same character controller as in this, so you could easily achieve that.
So a character controller is just a representation of your character in a dynamic 3d environment. You can jump on rigid bodies, climb ladders (commands supplied to make anything a ladder), and push rigid bodies (you can set the strength of the character controller). I am basically just supplying easy methods to make use of character commands. But let's take a test I had done for myself that made use of a character controller in a Halo level (bloodgulch, and yes, I like halo a lot. That's the only reason why the anti-grav vehicle command set exists in this plugin...) This is just the code for creating the character:
xeno make character controller 1, 1, 1, 0.5, 10, 2, 150
xeno set character controller position 1, 1, 5, 30
Now for starters, we have the xeno make character controller function. The first parameter is the ID of the character, the second parameter is the height of the character, the second is the radius, the third is the crouch height, the fourth is the maximum move speed (10 here, so obviously fast, but fps games tend to not be realistic), the fifth is the jump height (two meters again), and then the sixth is the strength (so the character has a strength of 150).
The next line is just to position the character controller at a certain position.
Now we have, in the main loop, the movement. For prerequisites, lets just say we have yAngle and xAngle defined as floats before the program enters the main loop. This is a first person example, btw. Anyways, now we have the main loop (or a portion of it)
xeno update
if keystate(17)
xeno move character controller forward 1
endif
if keystate(31)
xeno move character controller backward 1
endif
if keystate(30)
xeno move character controller left 1
endif
if keystate(32)
xeno move character controller right 1
endif
if spacekey()
xeno character controller jump 1
endif
if controlkey()
xeno character controller crouch 1
endif
cameraX = xeno get character controller position x(1)
cameraY = xeno get character controller head position(1)
cameraZ = xeno get character controller position z(1)
yAngle = wrapvalue(yAngle + mousemovex() * lookSpeed)
xAngle = wrapvalue(xAngle + mousemovey() * lookSpeed)
xeno set character controller rotation 1, yAngle
rotate camera xAngle, yAngle, 0
position camera cameraX, cameraY, cameraZ
Ok, obviously this is a bit more code, but it's pretty straight forward. We update XenoPhysics, then we check if the user presses any keys. If he or she presses w, then the character controller will move forward at the defined maximum speed (this is going to change so you can input a value from 0 to 1, where that is the percentage of the maximum speed). You continue doing similar commands for wsad.
Now we get to check if the user presses the space key. If he or she does, then tell the character controller to jump. Note that the character cannot jump in the air, so it is checked internally. If enough people desire it, I may add in support for an arbitrary number of jumps.
Anyways, now we have check for the control key. If the user presses this, the character will crouch. If the character crouches in mid air, the "legs" are brought up and the head position is unaffected. If the character crouches whilst on the ground, the head goes down. So if you jump, and then crouch in air, and land, you will still be crouched. Then, when you "stand up", or let go of control, your character will then extend his torso up. Basically I covered all that stuff for you.
Now after all that we just get the characters x and z positions and then its head height. I'll have a command so that the programmer can specify, in local coordinates, where the head is and then return that x y and z position.
Now after all of that, we update the yAngle and xAngle variables for mouse look, and then rotate the character with the yAngle. This will then rotate the character, making move forward move forward in its rotated coordinates. This is then converted to radians then put into an empty vector which is converted into a quaternion (as Havok handles rotations in quaternions).
That should explain what the character controller does. It handles your character movement, basically. You can also disable and enable characters (removing them from the world) just in case, for instance, you want to have vehicles and you wouldn't want a ghost character lingering in one place.