Character Movement
Blitz3D Forums/Blitz3D Beginners Area/Character Movement
| ||
I know this is a question that is not a simple matter of a few lines of Code. But I was Looking for Some Ideas. I am working on a Lunar Lander Type Game, I have a pilot that is going to be in the Ship when It lands and have the capibility to Walkaround, I have never been able to make good code for a character to walk around a terrain. My terrain is not a blitz Terrain, but a Mesh Terrain. Does anyone want to share a little code to help. I looked at the Castle Demo, but that seems a little too basic. Regards, Eric |
| ||
"Looking for Some Ideas" Ideas about what exactly? You could be more specific. I mean, I'm not going to write a full character control system for you. Do you need help with camera relative movement? Camera control? Making the character stick to the terrain surface? Animating the character along with the movement? I wrote this sample a while ago that has code for third-person camera movement: www.moondoggieent.com/downloads/ninja_test.zip |
| ||
Here's a little code that includes a smooth cam. It's not really much. You kinda have to build you own way sort of. But the camera movement is important. You don't really want it to be too rigid, as it might make your controls seems worse i feel.Graphics3D 800,600 SetBuffer BackBuffer() Global cam = CreateCamera() Global light = CreateLight() Global player = CreateCone() Global cam_pivot = CreatePivot(player) PositionEntity cam_pivot,0,1,-5 Global ground = CreatePlane() PositionEntity ground,0,-1,0 ; CREATE A PLANE AND A TEXTURE Global g_tex = CreateTexture(64,64) SetBuffer TextureBuffer(g_tex) For loop = 0 To 100 Color Rand(10,255),Rand(10,255),Rand(10,255) Rect Rand(0,60),Rand(0,60),Rand(1,3),Rand(1,3) Next EntityTexture ground,g_tex ; ____--_____________________ While Not KeyHit(1) If KeyDown(203) Then TurnEntity player,0,1,0 If KeyDown(205) Then TurnEntity player,0,-1,0 If KeyDown(200) Then MoveEntity player,0,0,0.1 If KeyDown(208) Then MoveEntity player,0,0,-0.1 update_cam(100) ; lower the number in the brackets for quicker cam movement UpdateWorld RenderWorld Flip Wend End Function update_cam(speed#) PointEntity cam,cam_pivot MoveEntity cam,0,0,EntityDistance#(cam,cam_pivot)/speed PointEntity cam,player End Function EDIT >> Probably not half as good as Joe's link << |
| ||
Joe, I didn't expect you to write a whole system for me, sorry if I gave that impression. I guess, I'm concerned with sticking to the terrain, Jumping. But i guess the bottom line is, I want it to be effiecient. Ross, Thanks for the code, I will play with it when I get home. I already have my camera Routine running, And it seems pretty smooth. I will Play when I get home, and figure something out then, post questions on how to improve it. Regards, Eric |