- Home /
How do I render something specific to a camera?
I am making a multiplayer fps and am currently modeling and animating assets before I begin. I realized that I want to model arms and a gun to be specific to the player controlling it, so I can position them to look good to the camera, and have a model for everyone else to see, and there will be many instances of this. I need the camera of the controller to only render his arm-gun model, and not everyone else's arm-gun model. I don't know if I could use camera layers...
Answer by Loius · Mar 19, 2013 at 04:57 PM
The arms of other players shouldn't even exist on this player's client.
You can only look from one player's point of view at a time, so you only need one 'arms'. You can use camera layers, for sure - in fact, layers also prevent your first-person models from shoving through the wall in front of you.
You can only see arms while in someone's first-person view. So, if you're not in first-person, move the arms out of view, and when you go back in, move them back in view. Or disable/enable them.
Okay. Thanks, but to do this, would I only have a network view attached to the player model and not the gun model? The gun is a child of the camera, which is a child of the first person controller with the model and first person controller collider. I understand this, I just don't know how to implement it.
The only thing that needs to be sent to the client from all the other clients is the other players' models I realize, so I have a question: If i have a Network View attached to the model of the player with the animations and the collider and all, would Its children also be sent to the clients?
Answer by hoy_smallfry · Mar 19, 2013 at 05:03 PM
Camera layers are actually exactly what you need to do if its a split screen multi-player. You need to have a layer for the arm-gun model, and one for the full-body model, one for each character. Example:
arm_gun_1, full_body_1, arm_gun_2, full_body_2, ... arm_gun_N, full_body_N
Then, mark each corresponding model with their layer (you probably should have them in separate game objects to do this).
Finally, go to the camera inspector properties. Under "Culling Mask", make Player 1's camera use "Default", "arm_gun_1", "full_body_2", "full_body_3", ... "full_body_N". Then do the same with the other cameras, each one only using their player's "arm_gun_X" layer.
If its a online multiplayer, then there is no need for arm models attached to the other player characters. The only thing that needs to be sent through the network is data regarding the players position, direction, speed, what he's currently doing, etc. The game should then just do whatever it wants to render that information, which in this case means showing only the players set of hands and the other players full bodies.
Thanks. I was wondering how I would do this with split screen.
Your answer
Follow this Question
Related Questions
Zooming in with a gun, Halo style. 2 Answers
How to get the camera to hold the gun? 1 Answer
Problem with camera 1 Answer
camera rendering fps 0 Answers
FPS (sometimes) invisible gun?! 2 Answers