- Home /
How i can create a cube with specific coordenates?
Hi to all,
How I can create a cube, which begins at "point A" and end at "point B "?
Is to create a wake of shooting . THANKS IN ADVANCE!
Answer by flaviusxvii · Mar 17, 2011 at 03:50 AM
Something like this:
public var pA:Vector3; public var pB:Vector3;
function Start() { // Assuming this is run on a unit cube. var between:Vector3 = pB - pA; var distance:float = between.magnitude; transform.localScale.x = distance; transform.position = pA + (between / 2.0); transform.LookAt(pB); }
Answer by Jason 6 · Mar 17, 2011 at 02:47 AM
var MyCube:GameObject;
function Start() { Instantiate (MyCube, Vector3(0,0,0), Quaternion.identity); //Change the vector 3 to the position you want. }
And look at this http://unity3d.com/support/documentation/ScriptReference/Object.Instantiate.html
Answer by Bunny83 · Mar 17, 2011 at 05:39 AM
Maybe take a look at this:
http://answers.unity3d.com/questions/42798/how-to-scale-and-move-a-cuboid-so-that-it-fits-between-two-points
Your answer
Follow this Question
Related Questions
Detemine wich side of a cube was hit 1 Answer
How can i tell the distance from a raycast? 1 Answer
How to get a rayhit to detect tags? 1 Answer
Raycast Normals Not Orthogonal to Cube Faces 0 Answers
Picked up cube passes through walls 2 Answers