I basically need to copy the ball pitcher from the Homerun track. I want an object to rotate and aim at the rider as he goes in a circle around it.
Does anyone know how to do it?
Maybe have a dummy following the rider (with object position event) and have the ball pitcher target the rider with a physics tool (select target to follow) Turn force as low as you can or maybe the base glued to it would keep it stationary.
The dummy object is unnecessary because I can just choose the rider as the target. (My object won't actually be shooting things)Originally Posted by Jarr3tt88
I tried doing it with a pipe by gluing a physics force to it that points at the rider. I attached the pipe to a stationary object below it with a rotational physics hinge. This almost works. The object does rotate on one axis and it does follow the rider, however it is very, very sluggish in doing so and also has trouble stopping its rotation once it gets going. I tried messing with the settings on the hinge and physics force but it still rotates way too easily and "overshoots" what its aiming for.
I'm guessing I'm gonna have to use object position events to make it look good.
use a set_position_event to set the yaw of the object to atan2(z1-z2,x1-x2)
where x1 and z1 are the x and z position of the object
and x2 and z2 are the x and z position of the rider
Moar trigonometry?!?Originally Posted by kamesatlee
Can you explain this to someone who apparently didn't take enough math in College... :/
I didn't completely understand it either but with a little guessing I figured it out and it works. Unfortunately, the object I want to rotate is actually made up of a bunch of little different objects, all of which rotate independently. This causes my object to completely fall apart whenever it rotates. I guess my object is too complicated for this to work.Originally Posted by thebeardo
Here's what I did:only did it on one axis)
Stored the Z positions of the object and rider.
Used a two-input operator, (Z Position of object - Z Position of rider)
Used another two-input operator to multiply that number by another number. The bigger the number I multiplied by, the more the object seemed to rotate. (Sometimes too much)
Took the arctangent of that number, and set it as the yaw of my object.
Okay that kinda makes sense.. Still not sure what the arctangent does in that case. Maybe because I don't see what its doing.
Is there an easy way to set up an arctangent linked object or movement that shows me what is happening.
arctan2 uses the distance between two points on each axis to calculate the angle between them.
It is not the same as arctan, which takes an angle and returns... the arctan of that angle.
This page has an interactive arctan2 demo:
http://polygeek.com/1819_flex_exploring-math-atan2
(note the angles in this demo are in radians)