i have a problem
i want this ,from one point to another,How can i do
If you're working with a rigidbody, you could look into using the AddForce() method.
should go where I want, does not work with addforce
Answer by noman.waseem · Jan 15, 2016 at 11:22 PM
You would really need to provide more details, but if you're asking about moving a rigidbody in gravity from point A to B in a ballistic trajectory, you can still do it with AddForce() but would have to do some additional calculations, as per:
// Calculate the change in velocity.
Vector2 deltaVelocity = new Vector2(
(target.transform.position.x - transform.position.x) / time - rb.velocity.x,
(target.transform.position.y - transform.position.y) / time - Physics.gravity.y * time / 2 - rb.velocity.y
);
// Calculate the force to apply.
Vector2 force = rb.mass * deltaVelocity;
rb.AddForce(force, ForceMode2D.Impulse);
where time is the number of seconds the trajectory should take.
Answer by muflichkamil · Jan 16, 2016 at 03:40 AM
I was thinking to use AddForce, and then combine that with gravity in the character itself. I am not sure because I am really new here, but IMHO that will works on your case.
Your answer
Follow this Question
Related Questions
My character doesn't move. How should I do? 1 Answer
how to make the camera move backwards when the game is started? 0 Answers
How to make an object not move through an wall using transform.translate? 3 Answers
Move a game object when player rotates Unity 2.5D 0 Answers
Stop moving gameObject and push it back 0 Answers