unity3d - Building/constructing buildings at runtime -


I am playing with an FPS, where I can be able to build / build my own buildings of my own Wanna start from the beginning I have searched for the surrounding solutions / principles, but by now I can not find anything suitable for my needs, if I remember anything, please tell me in the right direction

Where I am now, I have three prefibes; The floor, the wall and the wall with the opening of a door first I want to instantinate the floor tiles, which I can keep on the walls, and hopefully it will be able to pull the walls to the edges / corners of the floor tiles.

Can someone point me in the right direction how to do this? Apart from this, does my desired "work flow" make sense to everyone? In advance for any damage there

thanks

Update:?! Here I am in relation to what the installation prefabs, and as long as it works (except it is like I'm shooting the walls), I have the edges of the wall corners / closest floor (which is already a The same fashion has been instantiated.

 want to snap>  [Need type (CharacterController)] Public Class PlayerController: MonoBehaviour {// prefabs The GameObject wallPrefab; // Variable Initialize before the game declared here (awake) (wallPrefab = (GameObject) Resources.Load starts ("WoodWall");} // This happens every time the zero update () {if (Input.GetButtonDown ("Fire1")) // // Instant New Wall Illustrations (wallPrefab, cc. Transform.position + cc.transform.forward + vector3 .up * 1.0f, wallPrefab.transform.rotation);}}  

}

< Div class = "after" text "itemprop =" text ">

Hmmm ... well a solution that I can think of, to find a floor, the Wall Raycast is downwards, then that floor Regarding, go to a predefined position (if this is a Got found). Stick it in a script in the wall prefabs:

  zero start () {var down = transform.TransformDirection (Vector3.down); // Below is not really the downward direction of your object, to ensure that check the RaycastHit hit; If (Physics.Raycast (hit, exit, out, transform.position, bottom) & amp; hit.collider.gameObject.name "myFloorName" ==) // perhaps tag here name {Vector3 floorPos = hit.collider.gameObject Instead use .transform.position; Vector 3 floor size = hit.colider.object.transform.localScale; This.transform.position = new vector 3 (floorPos.x - floorSize.x / 2, floorPos.y - this.Tranform.localScale.y / 2, floorPos.z); // It may be negligible with correctness}} Zero Update () {}  

Vector 3. Downward wall is not consistent with the direction below, because it is on 3D Depending on the model, you may also need to fiddle with that situation may need to be negligible along with the situation (it assumes that y corresponds to height, which can not be the case) , But hopefully this tells you how to do this Is. Apart from this, if you do not know what the name of the floor object is, then maybe you can check with tags, which is probably easy.

If some further explanation is required, leave a comment and I will get back to you


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -