viernes, 12 de junio de 2020
c# scripts importantes sobre disparos
using System.Collections.Generic;
using UnityEngine;
public class pluma: MonoBehaviour {
//public GameObject Sphere;
// Use this for initialization
public Rigidbody Sphere;
public float velocidad = 80f;
void disparador () {
Rigidbody SphereClon = (Rigidbody) Instantiate (Sphere, transform.position, transform.rotation);
SphereClon.velocity = transform.up * velocidad;
//void Start () {
}
// Update is called once per frame
void Update () {
// void Update () {
}
void OnTriggerEnter(Collider other) {
//if (other.gameObject.CompareTag ("avismo")){
//if (other.gameObject.CompareTag ("pepe")){
if (other.gameObject.CompareTag ("pollo")){
//if (Input.GetKey (KeyCode.Space)) {
//Instantiate (Sphere);
disparador ();///////////////////////////imbento yo
}}
}
-----------------------------------------------------------------------------------
--------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class girometralleta : MonoBehaviour {
public float velocidadRotac = 0f; // 30 grados por segundo
void Start () {
//transform.rotation = Quaternion.Euler (0,45, 0);
}
// Update is called once per frame
void Update () {
// Es la rotacion de Angulos de Euler en grados.
//transform.Rotate (new Vector3 (0 * Time.deltaTime, 1, 0), Space.Self);
transform.Rotate(Vector3.down * velocidadRotac * Time.deltaTime);
}
}
------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class rotardeunity : MonoBehaviour {
//public float velocidadTraslac = 2f;
public float velocidadRotac = 30f; // 30 grados por segundo
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
if (gameObject.name.Equals("Cube"))
{
transform.Rotate(Vector3.right * velocidadRotac * Time.deltaTime);
//transform.Translate(Vector3.left * velocidadTraslac * Time.deltaTime);
}
else
{
transform.Rotate(Vector3.right * velocidadRotac * Time.deltaTime, Space.World);
//transform.Translate(Vector3.right * velocidadTraslac * Time.deltaTime, Space.World);
}
}
}
---------------------------------------------------------------------------
------------------------------------------------------------------------------
---------------------------------------------------------------------------------
---------------------------------------------------------------------------
------------------------------------------------------------------------------
---------------------------------------------------------------------------------
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class girabaile : MonoBehaviour {
void Start () {
//transform.rotation = Quaternion.Euler (0,45, 0);
}
// Update is called once per frame
void Update () {
// Es la rotacion de Angulos de Euler en grados.
transform.Rotate (new Vector3 (0 * Time.deltaTime, 1, 0), Space.Self);
}
}
https://youtu.be/Db-q-_ymYHg
No hay comentarios:
Publicar un comentario