Comments and answers for "Find the right angle for certain distance with arc effect?"
http://answers.unity.com/questions/355673/find-the-right-angle-for-certain-distance-with-arc.html
The latest comments and answers for the question "Find the right angle for certain distance with arc effect?"Answer by Pauls
http://answers.unity.com/answers/358040/view.html
So, this is not the best approach i think, but it kind of works, i used a characterController instead of a Rigidbody, and tell the ball to change its orientation comparing to the distance it has already made. If someone finds a good approach, he is welcome to share :) Hope this helps anyway :
function Start () {
thisTransform = GetComponent(Transform);
character = GetComponent(CharacterController);
distM = Vector3.Distance(cube.position, thisTransform.position);
startPoint = thisTransform.position;
//rotation to parallel
parallel = thisTransform.rotation;
parallel.eulerAngles = Vector3(0, 0, 0);
}
function Update () {
var dir : Vector3 = cube.position - thisTransform.position;
//if 1/3 of distM
if (Vector3.Distance(startPoint, thisTransform.position) > distM/3 ){
if (Vector3.Distance(startPoint, thisTransform.position) < distM/2){
//from 1/3 to middle
thisTransform.rotation = Quaternion.Slerp( thisTransform.rotation, parallel, Time.deltaTime *speedRot );
} else {
//from middle to end
thisTransform.rotation = Quaternion.Slerp( thisTransform.rotation, Quaternion.LookRotation(dir), Time.deltaTime *speedRot );
}
}
if (Input.GetAxis("Horizontal")>0) yes = true;
if (yes) {
character.Move(thisTransform.forward * Time.deltaTime *30);
}Mon, 03 Dec 2012 00:37:23 GMTPaulsComment by Pauls
http://answers.unity.com/comments/357622/view.html
@fafase thanks fafase, the link with angrybird is actually just a direction you take from the end point of the mouse, and then you add a force to this direction. I haven't found yet, but i am trying something, i set the same angle/direction for all kind of distance, and calculate when we're at the middle of the distance, if so i change the direction towards the target, i haven't tried yet, if it works ok i will confirm. ;) Thanks for the comments anyway, if anybody sees this thread and thinks of any other idea, please post, your idea/answer is welcome! ;)Sun, 02 Dec 2012 02:27:16 GMTPaulsComment by fafase
http://answers.unity.com/comments/355830/view.html
Ok you may want to have a look at this page http://unitygems.com/mistakes1/
Check out the rigidbody section. There is a AngryBird like demo. You will see that the ball goes depending on the angle made by the mouse. $$anonymous$$aybe that will give you an idea.Wed, 28 Nov 2012 19:09:10 GMTfafaseComment by Pauls
http://answers.unity.com/comments/355797/view.html
@fafase but i would need more to calculate the right angle for the right distance, i thought i could just stop the addForce when the middlepoint between A and B has been passed, but i miss the logic to find the right angle. Vector3.Angle would just give me the angle between 2 characters (x and z because both meshes have the same y) but not how much angle i would need to throw the ball in the air and make it come down at pointBWed, 28 Nov 2012 17:54:51 GMTPaulsComment by fafase
http://answers.unity.com/comments/355684/view.html
If you have the vector already,I would think you only need the angle with some world vectors like so:
Vector3.Angle(theVec, Vector3.forward);
Is that so ?Wed, 28 Nov 2012 13:45:11 GMTfafase