Question by
hellojbb1234 · Feb 01, 2017 at 09:15 AM ·
velocitylinerenderertrajectoryprediction
How do you calculate the points for a predictive trajectory line?
I have an orbital object that pulls something down like this
public void Attract(Rigidbody body)
{
Vector3 gravityUp = (body.position - transform.position).normalized;
Vector3 localUp = body.transform.up;
// Apply downwards gravity to body
body.AddForce(gravityUp * gravity);
// Allign bodies up axis with the centre of planet
body.rotation = Quaternion.FromToRotation(localUp, gravityUp) * body.rotation;
}
and then I have another code that shoots something in the opposite direction of where the mouse was pulled and that is the rigidbody.velocity x and y. So how do you calculate based on those two things th puling of the gravity towards a center and the velocity of the object
Comment