Throw item to target position

bitmore

Member
Hi,
I want the AI character can throw a bomb to the position of the player,
In TrajectoryObject i see there are methods to simulate trajectory with the given end position.
I don't need the trajectory so I subclass the ThrowableItem and calculate the m_Velocity before we throw the item so that the item can land on target position.
But in ThrowableItem.ThrowItem(), the m_Velocity was rotated to lookDirection, as far as I understand, if the originator was face the target and the m_Velocity was calculated by given end position, then we shouldn't rotate the m_Velocity again, is that right?

001.png
002.png
 
Yeah you've got the right idea. Alternatively, you could use a custom look source (class that implements ILookSource - see LocalLookSource for an example) on the character that always returns Vector3.forward for LookDirection. Or, calculate the direction such that it doesn't take the character's rotation into account.
 
Top