void Start() { l = transform.Find("LineRender").GetComponent <LineRender> (); cam = GameObject.Find("CameraSurface").GetComponent <Camera> (); surface = transform.parent.gameObject.GetComponent <Surface> (); }
void Start() { l = transform.Find("LineRender").GetComponent <LineRender> (); cam = transform.Find("Camera").GetComponent <Camera> (); curve = transform.parent.gameObject.GetComponent <Curve> (); }
// Start is called before the first frame update void Start() { PaturuControy.NameSet(); sg = false; TName(); Drag = true; drag2 = true; DestoyCount = 0; timer = Keeptimer; DestoySize = -1; SwichType = false; DeleteList = new List <GameObject>(); _min = GetComponent <Mian>(); CScorecount = GetComponent <ScoreCount>(); CLine = GetComponent <LineRender>(); lineSize = 0; linePosCount = 0; Tag_ColorControlName = null; Back = false; m_SoundManager = GameObject.Find("GameSoundManager").GetComponent <GameSoundManager>(); //PaturuControy.Skill.Water6Swich = false; PaturuControy.waterskill_six.UpdaterCountDown = false; PaturuControy.ColorUpadateCtr = false; SkillCostManager.Skill_Control.Water6Swich = false; }
public void DrawLine(Block newBlock) { if (lineRender == null) { lineRender = LineRenderPooling.current.GetPooledObject().GetComponent <LineRender>(); } lineRender.DrawLine(CheckBlockTrend(newBlock), transform.position); }
public void GumClear(Collision2D coll, GameObject go) { Vector2 touchPenPos = go.transform.localPosition; LineVertsInfo m_lineVerts = coll.gameObject.GetComponent <LineVertsInfo>(); LineRender m_lineRender = gameObject.GetComponent <LineRender>(); bool isStart = true; bool isEnd = false; int startIndex = 0; int endIndex = m_lineVerts.LineVerts.Count; List <Vector2> startLine = new List <Vector2>(); List <Vector2> endLine = new List <Vector2>(); for (int i = 0; i < m_lineVerts.LineVerts.Count; i++) { float x = m_lineVerts.LineVerts[i].x - touchPenPos.x; float y = m_lineVerts.LineVerts[i].y - touchPenPos.y; x = x * x; y = y * y; if ((x + y) < mLogicHandle.GumAmount) { if (isStart) { isStart = false; startIndex = i; } else { endIndex = i; } } else if (endIndex > 0) { isEnd = true; } if (isStart) { startLine.Add(m_lineVerts.LineVerts[i]); } else if (isEnd) { endLine.Add(m_lineVerts.LineVerts[i]); } } if (startLine.Count > 1) { m_lineRender.NewVerts = startLine; m_lineRender.CreateLineGo(); } if (endLine.Count > 1) { m_lineRender.NewVerts = endLine; m_lineRender.CreateLineGo(); } Destroy(coll.gameObject); }
private void DrawPath(GLContext context, LineRender render, List <Vector3> points, Vector4 color) { var shader = GlobalShaders.GetShader("LINE"); context.CurrentShader = shader; shader.SetVector4("color", color); render.Draw(points, new List <Vector4>(), true); context.CurrentShader = null; }
// Use this for initialization void Start() { l = transform.Find("LineRender").GetComponent <LineRender> (); cam = transform.Find("Camera").GetComponent <Camera> (); b = transform.parent.gameObject.GetComponent <Basis> (); colorChoice = new Color[3] { Color.red, Color.blue, Color.green }; }
public static LineRender CreateLineRender(Person pers, H type) { LineRender obj = null; obj = (LineRender)Resources.Load("Prefab/GUI/3dHelpers/LineRender", typeof(LineRender)); obj = (LineRender)Instantiate(obj, new Vector3(), Quaternion.identity); obj.transform.name = "LineRender"; obj.Person1 = pers; obj.Type = type; //if (container != null) { obj.transform.SetParent(container); } return(obj); }
private void Awake() { pubLine = this; _lineRenderer = GetComponent <LineRenderer>(); _lineRenderer.material = new Material(Shader.Find("Particles/VertexLit Blended")); _lineRenderer.positionCount = sections + 1; _lineRenderer.startWidth = 0f; _lineRenderer.endWidth = 0f; for (int i = 0; i < (sections + 1); i++) { x = Mathf.Sin(Mathf.Deg2Rad * angle) * radius; y = Mathf.Cos(Mathf.Deg2Rad * angle) * radius; _lineRenderer.SetPosition(i, new Vector3(x, z, y)); angle += (360f / sections); } pubLine = this; }
void FixedUpdate() { fixedUpdateCount++; StateMachine.Update(); if (StateMachine.State == StSwing) { if (positionChanged) { // Set the transform to the new position GetComponent <Transform>().position = newPosition; } // Update the line render endpoints at the end of each step LineRender.GetComponent <LineRenderer>().SetPositions(lineRenderEndpoints); Debug.Log("Swing force: " + SwingForce + " " + "MoveForce: " + MoveForce); rb.AddForce(SwingForce); } rb.AddForce(Vector2.right * MoveForce); var clampedVelocity = new Vector2(Mathf.Clamp(rb.velocity[0], -MaxRunSpeed, MaxRunSpeed), rb.velocity[1]); rb.velocity = clampedVelocity; }
//---------------------Manipulation interaction operations------------------------ void RotateObject(Hand hand, HitBall m_ControllBall_L, IFuncType type_in) { switch (type_in) { case IFuncType.Init: originDirec = m_ControllBall_L.direc; originQ.SetFromToRotation(originDirec, originDirec); break; case IFuncType.Update: // check is too close to center if (m_ControllBall_L.radius < 0.05) { originDirec = m_ControllBall_L.direc; originQ.SetFromToRotation(originDirec, originDirec); return; } nextDirec = m_ControllBall_L.direc; nextQ.SetFromToRotation(originDirec, nextDirec); //Debug.Log(Vector3.Dot(originDirec.normalized, nextDirec.normalized)); // check if two vector is very similar if (Vector3.Dot(originDirec.normalized, nextDirec.normalized) > 0.999) { return; } GameObject a = GameObject.Find("CubeTest"); Quaternion q = Quaternion.Slerp(originQ, nextQ, Time.deltaTime * 10); LineRender lr = a.GetComponent <LineRender>(); if (Mathf.Abs(q.x) > Mathf.Abs(q.y) && Mathf.Abs(q.x) > Mathf.Abs(q.z)) { q.y = 0f; q.z = 0f; lr.DrawXCycline(); } else if (Mathf.Abs(q.y) > Mathf.Abs(q.z)) { q.x = 0f; q.z = 0f; lr.DrawYCycline(); } else { q.x = 0f; q.y = 0f; lr.DrawZCycline(); } //if (orginRotationAxis != CurrentRotationAxis) //{ // orginRotationAxis = CurrentRotationAxis; // originDirec = nextDirecl //} a.transform.rotation = q * a.transform.rotation; originDirec = nextDirec; originQ = nextQ; break; case IFuncType.Close: break; default: break; } }
void Init() { TargetPositionPathRender = new LineRender(); PositionPathRender = new LineRender(); CameraRenderer = new CameraRenderer(); }