hiding entities in a single camera
Blitz3D Forums/Blitz3D Programming/hiding entities in a single camera
| ||
I'm making a multiplayer first-person shooter game- and currently you can see "inside" your own character mesh, which shouldn't happen. is there any way to hide just your own player model in your own camera, so the player will be able to see the other players but not themselves? |
| ||
LAN/WAN multiplayer answer - Don't draw local players mesh. Have it hidden, or better yet, don't have it at all. Split screen multiplayer answer - I think doing a separate render for each viewport should work. You can deactivate cameras with cameraprojmode cam,0 |
| ||
If you've hidden your own mesh you may now be finding out that collisions don't work. So create a pivot and entityparent your model to it. Set up collisions etc for the pivot, and hide the model. |
| ||
it's split screen, and thanks, it worked. but as John Blackledge says, the collisions don't work. I made the entities transparent instead of hiding them, but bullets still collide with the player. I mean, the pivot solution sounds like it could work, it'll just take quite a lot of tweaking. |
| ||
Workaround: Do your updateworld() and collision code Then hide player1 and camera 2, and render camera 1 Show player1, camera2, hide player2 and camera1 and render camera 2. Easy :o) UpdateWorld ; Render first camera HideEntity camera2 HideEntity player1 Renderworld ;Render second camera, hiding the second player and the first camera. HideEntity camera1 HideEntity player2 ShowEntity player1 ShowEntity camera2 Renderworld Flip |
| ||
Why can't you just move the camera forward a little bit? If it's first person the camera should be at the location of the eyes, in which case you don't see any mesh anyway. |
| ||
Then your centre of rotation would be off with your character though. Gives you a strange effect. |
| ||
Yeah, I forgot about collisions. That's because I use internal 3d commands only for drawing. In your case I'd go with Ross. I think there's the other render missing in the example? |
| ||
Yeah, your right. Well spotted. Updated :o) |
| ||
don't worry, I've solved the first problem already- in the way Ross C mentioned in #5. my current problem is slightly different- the bullets are still colliding with the character mesh on the "way out"- I kind of need to know exactly where collisions get registered- is it every time an entity is moved, or during updateworld? |
| ||
Only during updateworld. |
| ||
hmm, that's a problem. basically, there are three meshes involved in bullet collisions: the pivot, that the player follows, that collides against the scenery but not with bullets; the player, that follows the pivot, and bullets collide with it; and the bullet, which are all types. I shoot bullets out of the player's centre, but they hit me as they leave me (I'm a bit of an odd shape, you see). I can only think of two solutions- change the players so they each have thier own collision type, but this could make the collisions very complex- and involve a lot of rewriting the script- (especially as it accomodates limitless players) or produce the bullet slightly in front of me. that just causes problems for close range fire. got a bit off topic now, but... yeah. |
| ||
You should allow the bullets to collide with the pivot too, not the player. Surely, full polygon collision for the players is a bit OTT, applying a simple ellipsoid collision to the pivot should look fine in most cases. |
| ||
You could even, if you want, attach pivots to the mesh for the head, arms, torso and legs collision if you wanted slightly more accuracy, but not full polygon. Alot more work involved in that though. |
| ||
I've solved it now. I took all collisions off the player and did what Ross C suggested, by putting simpler meshes on top of the old ones. thanks for the help! |