Hi, In my unity project I have a catapult that fires a block. So far I have made it so that after the catapult arm holding the block is rotated to a certain angle, it unchilds the block and makes it non-kinematic. I currently have it so it then applies a constant force to the z axis to speed it up. I also have it so that a force is applied in the y axis to bring it down to earth.
The problem is that I want it to do a typical trajectory curve. At the moment the problem is the z force reaches 10 and then an if statement decreases it and then because when it is decreased it no longer meets the criteria of that if statement it then increases then (effectively this causes it to balance out at a force of 9).
Another problem is that currently the y force only pulls the object down. I want it to rise and then fall.
The final problem is that I want the force to stop substantially when it hits another object.
Here is my current code that runs when the projectile is detached from the catapult object.
gameObject.tag = "projectile"; function Update () { if(rigidbody.isKinematic == false) { if(constantForce.force.y >= -10) { gameObject.constantForce.force.y -= 0.1; } if(constantForce.force.z <= 10 && constantForce.force.z >= 0) { gameObject.constantForce.force.z += 1; } if(constantForce.force.z == 10) { gameObject.constantForce.force.z -= 2; } } }