- Home /
Question by
markfm · Dec 28, 2012 at 09:30 PM ·
quaternionconversioneuler
Shooting towards a point using quaternions.
Hi,
I have been looking for a while now with no luck. This issue I have is that I am using Quaternion angle and not Quaternion.euler . In a nutshell I am trying to shoot a box from one point to another.
Point A- Being a touchscreen Tap Point B- Being an object which fires.
ball = GameObject.Find("MainBall");
Vector3 velforce = calculatePlatformRotation(ball.transform.localPosition,fingerPos) * 1200;
ball.rigidbody.AddForce(velforce);
CalculatePlatformRotation returns a Quaternion Angle based on the position on the ball and the finger tap. Does anyone have a way around this? The error I am seeing is:
Operator *' cannot be applied to operands of type
UnityEngine.Quaternion' and `int'
Comment
Not enough info for an answer, but you can get eulerAngles from the Quaternion returned by calculatePlatformRotation. Another possibility is to use Transform.LookAt() and then Rigidbody.AddRelativeForce().
Your answer
![](https://koobas.hobune.stream/wayback/20220613090046im_/https://answers.unity.com/themes/thub/images/avi.jpg)