Download,
Demo,
Demo Source,
VanillaLib,
VanillaLib Source
(Right click, save as)
About
A solution for those who require sliding collision. Though obviously slower than Sparky's / NGC plugins, this is released as a class (C#) for easy integration with your current project. This was just a test but then I decided to release the code to help any other beginners. Have a look at the demo and decide for yourself if it is usable. (Mouse to freelook around player, arrow keys to move)
How to use with your own projects
After including the class with your project and setting up object collision of two objects such as...
(1 is the integer of the bridge, 2 is the integer of the player model)
oDB3D.SetObjectCollisionToPolygons(1);
oDB3D.SetObjectCollisionToSpheres(2);
... then in order to use vanilla collision call this from anywhere in the game loop...
VanillaCollision.clsVanillaCollision.VanillaCollision(<move speed>, <max step up>, <static object>, <dynamic object> ) ;
VanillaCollision =
Namespace
clsVanillaCollision =
Class
<move speed> =
The speed in which the objects will collide
<max step up> =
The maximum height in which the player can jump seemlessly, such as climing stairs
<static object> =
The object which will not move i.e them .x map
<dynamic object> =
The object which will move i.e the player model
e.g.
clsVanillaCollision.VanillaCollision(Program.fltMoveSpeed, 50f, 1, 2);
Gravity usage
Vanilla Collision also supports the handling of gravity by using...
clsVanillaCollision.VanillaGravity(9.8f, 1, 2);
9.8f =
The speed at which the object will fall. (no acceleration until version 0.9)
1, 2 =
The objects involved (1 = Static object, 2 = dynamic object)
Misc
Unlike the demo above, if you used an invisible block to do the collision testing and then move the actual player model to that, the whole thing would look a lot smoother. Perhaps in the final version I will implement this if I decide to keep with this solution of sliding collision. Although its like a slide made out of lego, it is very easy to work with.
Let me know what you think!
regards,
Karsten
kpedersen@hotmail.co.uk