- 最后登录
- 2014-10-23
- 注册时间
- 2011-7-19
- 阅读权限
- 90
- 积分
- 81303
- 纳金币
- -1
- 精华
- 11
|
Moving skyboxes = multiple cameras.
One of the fastest things to set up is a simple skybox. It creates a visually pleasing backdrop and can add a lot to a game. After looking at a static skybox for a long time, it can get a bit “samey”. A quick look on the official forums and people were suggesting using multiple camera and setting up combinations of Clear Flags and Culling Masks. That’s all pretty easy to sort out, add another camera, I chose to make it a child of my main camera, and set its Clear Flags to “Skybox” and Culling mask to “Nothing”. Setting the main camera Clear Flags to “DepthOnly” and its Culling Mask to “Everything” gave me the correct result in each camera, just the skybox through the child and everything else with a blank area for the Skybox to sit. The problem was the child rendering the skybox on top of everything, the solution?
skyCamera.camera.depth = 1;
mainCamera.camera.depth = 2;Setting the camera depth property programmatically solved the issue. So now the skybox is rendered through a different camera, it’s free to rotate slowly and give you a dynamic backdrop.
Scripted Joints.
An annoying problem with a very simple solution! I wanted the chain to be made out of a varying number of links, so I could create short and long ones out of the same code. Another self-imposed requirement was making something useable out of the physics components. So, dynamic joints and rigidbodies were the order of the day. After messing about with the properties of configurable joints, I couldn’t understand why none of them had any discernable affect on my rigidbodies. One of those classic palm-to-forehead moments ensued when I realised you need to set the connected rigidbody AFTER setting all the variables!
//Set all variables, then:
cJoint.connectedBody = myChild.transform.rigidbody;These were two of the “little things” that caused me frustration, if my solutions solved either of the problems for you, I hope you found this post sooner rather than later!
Check back for more problem based solutions as I develop the project further. If there’s any interest, I’ll post the project source code after each project step. Enjoy!
由 uke发表 |
|