Previewing Object Trajectory

hey guys,
heres my problem:
im aplying a force to an object (throwing balls kinda like angry birds) & i would like 2 show the player the trajectory the throwable object will take till it hits the ground.

how can i calculate the positions (5 positions in mid-flight) the object will pass once ts thrown?

thanks ahead

You can do this using some quite simple equations of motion sometimes called SUVAT equations as S is displacement, U is initial velocity, V is final Velocity, A is acceleration and T is time.

Anyway I wasn’t sure how to describe how to do this as I was taught it over a whole module in maths so it would be a rather brief description if I tried but you can see the list of equations under suvat equations [here][1]

So as I can’t really describe the process easily, heres a script similar to what you want. It only works in 2D currently (facing from front using the x and y axis) and should be attached to something at the starting position of your object. It may need some editing as it uses Impulse which is ‘instantaneous force’ which is probably what you are actually using but I’m not sure.

var tSample = new Array();
var TrajVec = new Array();
var PrevD = 10.0;
var Samples = 5;
var GivenImpulse = Vector2(1, 1); //uses impulse rather than force, this is equal to a instantaneous force
private var u : Vector2;
var m = 1.0; //mass of object thrown
private var line : LineRenderer;

function Start () {
	line = gameObject.AddComponent ("LineRenderer");
	line.SetWidth(0.1, 0.1);
	for(var j = 0; j < Samples; j++){
		line.SetPosition(j, Vector3(0, 0, 0));

function Update () {

function UpdateLine () {
	for(var j = 1; j < Samples+1; j++){
		line.SetPosition(j, Vector3(TrajVec[j-1].x, TrajVec[j-1].y, 0));

function calcU (I : Vector2) {
	u = Vector2(I.x/m, I.y/m);

function calcTraj () {
	var ys : float;

	for(var xs = PrevD/Samples; xs <= PrevD; xs += PrevD/Samples){
	for(var i = 0; i < tSample.length; i++){
		ys = u.y * tSample <em>+ (-9.81 * tSample <em>* tSample _* 0.5);_</em></em>

_ TrajVec.Push(Vector2(PrevD/Samples + (PrevD/Samples * i), ys));
* }
hopefully you can get that working, if not feel free to ask me and I’ll try to help,