
Hi guys I have a question,
I want to make a script that lets me swipe my finger in a direction and the object ( the little orange ball) will get a force or velocity in the direction you swipe but also the strengt of the swipe. So if the swipe is short you will get a little bit force or the swipe is big your force will be greater.
I want to use this on the Iphone so a script with touch Is possible. Only curruntly I am not behind a mac computer so I cannot test it. So if the script can be test with the mouse input that would be great.
I use this script to calculate the swipe grapghic.
var targetPoint : Vector3;
function Update () {
if (Input.GetMouseButton(0)){
var playerPlane = new Plane(Vector3.forward, transform.position);
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
var hitdist = 0.0;
if (playerPlane.Raycast (ray, hitdist)) {
targetPoint = ray.GetPoint(hitdist);
transform.position = targetPoint;
}
}
}
I want to use physics so I can bounce of walls.
I have really no clue where to start. I searched the internet for soltions but there was no one post that could help me. Maybe I did mis some posts if is that the cause I hope you can redirect me to that post.
Thanks in advance.
Dennis Jongmans
Yeah I was thinking the same thing, only I dont know where to start to calculate the direction and the force of the ball
– anon25767001