HELP!!!!!!
Blitz3D Forums/Blitz3D Programming/HELP!!!!!!
| ||
i need som help whit my game the ""player"" is faling ture the ""terrain"" i fixt the colisons but it dont helps WHY!? |
| ||
post some code (and for future reference, try to be more descriptive than just "HELP!!!!!!") |
| ||
Graphics3D 800,600,16,1 SetBuffer BackBuffer() Const CAMERA_COL = 1 Const level_COL = 2 Global camera=CreateCamera() EntityType camera, CAMERA_COL PositionEntity camera,5, 7, 0 ;CAMERA Global cam_x#,cam_z#,cam_pitch#,cam_yaw# ; Current Global dest_cam_x#,dest_cam_z#,dest_cam_pitch#,dest_cam_yaw# ; Destination terrain=LoadTerrain("tex3.bmp" ) TerrainDetail terrain,999,True ScaleEntity terrain,10,1,10 grass_tex=LoadTexture("tex3.bmp" ) EntityTexture terrain,grass_tex,0,1 shoot=LoadSound("9mm.wav") EntityPickMode terrain, 2 Global Gravity# = 0.16 ;Game gravity Global PlayerGravity# = 0.0 ;------------------------------meshes------------------------------------------------------------------------ ;busch1----------------------- busch1 = LoadMesh("m_tree6.3ds") PositionEntity busch1, 35, 0.6, 35 ScaleEntity busch1, 1, 1, 1 ;busch2----------------------- busch2 = LoadMesh("m_tree5.3ds") PositionEntity busch2, 39, 0.6, 36 ScaleEntity busch2, 1, 1, 1 ;busch3----------------------- busch3 = LoadMesh("m_tree4.3ds") PositionEntity busch3, 60, 0.6, 45 ScaleEntity busch3, 1, 1, 1 ;busch4----------------------- busch4 = LoadMesh("m_tree6.3ds") PositionEntity busch4, 60, 0.6, 75 ScaleEntity busch4, 1, 1, 1 ;busch5----------------------- busch5 = LoadMesh("m_tree6.3ds") PositionEntity busch5, 30, 0.6, 30 ScaleEntity busch5, 1, 1, 1 ;busch6----------------------- busch6 = LoadMesh("m_tree5.3ds") PositionEntity busch6, 60, 0.6, 89 ScaleEntity busch6, 1, 1, 1 ;busch1----------------------- busch7 = LoadMesh("m_tree4.3ds") PositionEntity busch7, 60, 0.6, 60 ScaleEntity busch7, 1, 1, 1 ;warrior1----------------------- warrior = LoadMesh("warrior.3ds") PositionEntity warrior, 50, 0.6,55 ScaleEntity warrior, 1,1, 1 RotateEntity warrior, 0,155,0 ;olidrum1----------------------- busch1 = LoadMesh("oildrum.3ds") PositionEntity busch1, 38, 2.6, 55 ScaleEntity busch1, 0.1, 0.1, 0.1 ;olidrum2----------------------- busch1 = LoadMesh("oildrum.3ds") PositionEntity busch1, 35, 2.6, 44 ScaleEntity busch1, 0.1, 0.1, 0.1 ;wodcreat1---------------------- wcrate1 = LoadMesh("wcrate1.3ds") PositionEntity wcrate1, 38, 2.6, 68 ScaleEntity wcrate1, 00.1,00.1,00.1 ;wodcreat2---------------------- wcrate1 = LoadMesh("wcrate1.3ds") PositionEntity wcrate1, 34, 2.6, 68 ScaleEntity wcrate1, 00.1,00.1,00.1 ;wodcreat1---------------------- wcrate1 = LoadMesh("wcrate1.3ds") PositionEntity wcrate1, 36, 6.6, 68 ScaleEntity wcrate1, 00.1,00.1,00.1 ;gun1----------------------------- gun1 =LoadMesh ("Tommy.3DS",camera) ScaleEntity gun1, 5,5,5 texture=LoadTexture("tommy.bmp") EntityTexture gun1,Texture TranslateEntity gun1, .90, -.85,1 gun1ammo = 30 gun1reloads = 5 ;gun2------------------------------------- gun2 =LoadMesh ("Tommy.3DS") PositionEntity gun2, 35,2.6,65.8 ScaleEntity gun2, 5,5,5 RotateEntity gun2, 270,0,90 texture=LoadTexture("tommy.bmp") EntityTexture gun1,Texture ;cocke---------------------------- coke=LoadMesh("cokecan.3ds") PositionEntity coke,33,4.9,68 ScaleEntity coke,00.1,00.1,00.1 ;------------------------------sounds------------------------------------------------------------------------ ;TYPES Type hole Field entity End Type hole = LoadSprite("flare.bmp") HideEntity hole EntityPickMode terrain, 2 Collisions 1, 2, 2, 3 Collisions 2, 1, 2, 3 Collisions CAMERA_COL,LEVEL_COL,3,1 While Not KeyDown(1) Or Collisions ; Mouse look ;----------- ; Mouse x and y speed mxs=MouseXSpeed() mys=MouseYSpeed() ; Mouse shake (total mouse movement) mouse_shake=Abs(((mxs+mys)/2)/1000.0) ; Destination camera angle x and y values dest_cam_yaw#=dest_cam_yaw#-mxs dest_cam_pitch#=dest_cam_pitch#+mys ; Current camera angle x and y values cam_yaw=cam_yaw+((dest_cam_yaw-cam_yaw)/5) cam_pitch=cam_pitch+((dest_cam_pitch-cam_pitch)/5) ;Turn camera RotateEntity camera, cam_pitch#/2,cam_yaw#/2,0 ; Rest mouse position to centre of screen MoveMouse 400,300 If KeyDown( 57 ) =1 And Jumped =0 ;Jump check PlayerGravity# = 2.5 Jumped =1 EndIf If KeyDown( 54 ) =1 ;Walk key (Right Shift) WalkSpeed# = .05 Else WalkSpeed# = .5 EndIf If KeyDown( 157 ) =1 ;Fly mode (Right CTRL) FlyMode=1 Else FlyMode=0 EndIf If MouseHit(1) CameraPick(camera, MouseX(), MouseY()) h.hole = New hole h\entity = CopyEntity(hole) PositionEntity h\entity, PickedX(), PickedY(), PickedZ() EndIf If MouseHit(1) Then PlaySound=shoot If KeyDown( 32 ) TurnEntity camera,0,-5,0 EndIf If KeyDown( 30 ) TurnEntity camera,0,5,0 EndIf If KeyDown( 31 ) MoveEntity camera,0,0,-0.15 EndIf If KeyDown( 17 ) MoveEntity camera,0,0,0.15 EndIf RenderWorld Flip TranslateEntity camera, 0, -1, 0 Wend |
| ||
You didn't give the terrain an entitytype number |
| ||
EXMP entitytype LEVEL,TERRAIN_COL ? |
| ||
You didn't give the terrain an entitytype number Actually you haven't set up ANY collisions between player and terrain. |
| ||
Its late and things are starting to blur for me!! But it looks like you have not set an EntityType for your terrain. Also, I think you need to set EntityRadius for your camera as all blitz collisions need to be ellipsoid (sphere) to something. I gues you will be using elipsoid to polygon, as your terrain will need to be a polygon (rather than a box or another sphere). Hope that helps?? |
| ||
ok give me the cod then |
| ||
*slaps lasse with big fish* |
| ||
That entitytype, doesn't appear in the code you pasted. If your suggesting that's would should be there, then you don't actually have an entity called level in your code. You need to do:EntityType terrain, level_COL Should do the trick! |
| ||
Oh, and your while loop uses 'Collisions'. I think this should probably be 'CountCollisions'. Also, check your 'Collision' commands are setup correctly (I cant remember the settings offhand). Night, night ...... |
| ||
Try reading the docs a bit more, and looking at some of the sample code. |
| ||
still dont work out. can any one plz paste the hole code fore it all? |
| ||
That's impossible. We don't have the models. Read up on the following commands: Collisions() EntityType() UpdateWorld() EntityRadius() CountCollisions() You really do have to help yourself. And for what its worth, the above code is really just to messy to do anything with. Read up on 'Arrays', for a start. |
| ||
Why don't you start with something simple, like just a terrain and a camera. get collisions working between them. Always test your code along the way, before you add anything else. That way, you know whats broke alot easier. |
| ||
Gfk and Ross C are exactly right. The commands Gfk posted are the ones you need. As Ross suggests, don't bother with any of the scenery models or sounds or shooting and just write a demo of walking around a terrain in first-person view. |