Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.


  • Content Count

  • Joined

  • Last visited

Community Reputation

5 Neutral


About mido142857

  • Rank

Profile Information

  • Gender
  • Location:
  1. i think you should add this but its a tutorial though with a script http://armedunity.com/topic/6464-tutorial-grenade-trajectory-line-prediction/
  2. i was making a 2 way teleport pads for my game and when the player enters the collider 1 it sets a bool on collider 2 to make the teleport pad 2 ignore the player when he is sent to it , however this made problems because OnCollisionExit wasnot called or something on the first Collider so you couldnt repeat the process the only way i managed to fix this was by destroying the collider every time and adding a new one to reset it. and it worked very smoothly a 2 way teleport system. just saying maybe someone can find this useful.
  3. i was trying to fix it and the whole thread got messed up xD i fixed it now
  4. This tutorial will show you how to predict the trajectory of a grenade or any other projectile. I used simple cubes as path points in this tutorial you can change that to any prefab you would like or you can use the LineRenderer. Editor Screen Shots: https://www.dropbox.com/s/zrm721st5478630/One.jpg https://www.dropbox.com/s/6ltjk1jqbhgopz7/Two.jpg https://www.dropbox.com/s/genipedrke0guvi/Three.jpg The Code : using UnityEngine;using System.Collections; public class PredictionPath : MonoBehaviour { // Use this for initialization public Transform Cube; //This is the prefab we will be instantiating as the path steps Transform[] Cubes; //the array that will hold all the gameobjects that draw the path(path steps) public Transform ShootingPoint; //Shooting Point GameObject TidyParent; //just an empty game object to instantiate the path steps inside of it to keep things clean public Rigidbody Bullet; //the bullet rigidbody Vector3 Gravity; //gravity public float FrequencyMultiplier; //this will increase or decrease spacing between path steps public int Ammount; //ammount of path steps public Vector3 InitialVelocity; //the velocity by which you will shoot the projectile void Start () { Gravity = Physics.gravity; //sets our gravity variable to the defined project's gravity Cubes = new Transform[Ammount]; //creates a new array and sets its size to the Ammount variable TidyParent = new GameObject ("TidyParent"); //create empty gameobject for (int i=0; i<Ammount-1; i++) { //Instantiate Path Steps and save them in the array Cubes[i] = Instantiate(Cube,Vector3.zero,Quaternion.identity) as Transform; Cubes[i].parent = TidyParent.transform; } } void Update () { UpdatePath (); if (Input.GetKeyUp (KeyCode.Space)) { //Shoots the bullet for demonstration Rigidbody Clone = Instantiate(Bullet,ShootingPoint.position,Quaternion.identity) as Rigidbody; Clone.AddForce(InitialVelocity,ForceMode.VelocityChange); //THIS IS VERY IMPORTANT you must use ForceMode.VelocityChange because it doesnt depend on the mass unlike ForceMode.Impulse and it adds the velocity instantly, if you use the default forcemode the prediction wont work. } } void UpdatePath(){ for (int i = 0; i < Ammount - 1; i++) { //loop through the array and set each path step to its predicted position Vector3 PredictedPosition = PlotPath(ShootingPoint.position,InitialVelocity,i * FrequencyMultiplier); Cubes[i].position = PredictedPosition; } } Vector3 PlotPath(Vector3 InitialPosition, Vector3 InitialVelocity, float TimeStep){ return InitialPosition + ((InitialVelocity * TimeStep) + (0.5f * Gravity * (TimeStep * TimeStep))); //this is the very simple equation of motion s=ut+1/2at^2 just with Vector3 in 3 dimensions not one dimension as usual } }
  5. have you heard of a program called filter forge it can generate textures from texture filters made by the community and it even supports maps like normal maps
  • Create New...