FlyScript
|
  |
| Joined: 05 Aug 2010 |
| Total Posts: 2884 |
|
|
| 24 Mar 2015 07:06 PM |
I'm trying to make a turret work based on CFrame and point towards the mouse, so my idea is to construct two triangles and use the hypotenuse angle.
The first triangle would be to calculate the slew angle of the turret, and the second would be for the pitch. However, if the tank the turret is on were to get tilted, I need to take this into account. How would I draw the triangle on the same plane as the tank? |
|
|
| Report Abuse |
|
|
FlyScript
|
  |
| Joined: 05 Aug 2010 |
| Total Posts: 2884 |
|
|
| 24 Mar 2015 07:28 PM |
I have an example here to help visualise it: http://gyazo.com/0a6edbf5674a77433f6b93c333e3bb6c
The red dot is where the mouse is
The white line is the normal (0 degrees) for slew The black line is the normal (0 degrees) for pitch and is also the direction of slew
The yellow angle is the slew angle the blue angle is the pitch angle
I need a way of working out those two angles by "drawing" those triangles in the plane of the turret. I can do the maths of working out the angles fine; I just need advice on how to draw the triangles on a tilted plane. |
|
|
| Report Abuse |
|
|
FlyScript
|
  |
| Joined: 05 Aug 2010 |
| Total Posts: 2884 |
|
|
| 24 Mar 2015 07:32 PM |
| Would it be possible to get those angles by somehow drawing a vector from the turret to the point, and taking away the tilted normal turret (0 degrees tilt & slew) vector or something like that? |
|
|
| Report Abuse |
|
|
FlyScript
|
  |
| Joined: 05 Aug 2010 |
| Total Posts: 2884 |
|
| |
|
AlgyLacey
|
  |
| Joined: 14 Jun 2013 |
| Total Posts: 3736 |
|
|
| 25 Mar 2015 12:54 PM |
Try the Scripters forum.
-[ Check this out! http://www.roblox.com/games/217210581/Farmulator ]- |
|
|
| Report Abuse |
|
|