# Difficulty Understanding 2D Movement (Non-rigidbody) - Launch

Hello all,

EDIT: Sorry if this should not have been posted here, I didn’t notice the difference between the “Forum” and “Answers”

I’m having trouble with some specific movement I want to do in my 2D game I’m working on. I’ve opted to learn to make my own physics and detect collision with raycasts instead of using a rigidbody. A rigidbody would probably work better for what I want this game to be, but I’m using this smaller project to learn for a more ambitious game I want to make.

The problem: I don’t fully understand how transform.Translate() given a Vector2 moves an object with each Update(). I assume it changes the position of the transform to the position of velocity, but I can’t wrap my head around the units of measurement or why it moves how it does. The Move() function I am using is as follows:

``````public void Move(Vector2 velocity) {
UpdateRaycastOrigins();
collisionInfo.Reset();
if (velocity.x != 0) {
HorizontalCollisions(ref velocity);
}
if (velocity.y != 0){
VerticalCollisions(ref velocity);
}

transform.Translate(velocity);
}
``````

I think failing to fully understand this is holding me back from accomplishing what I really want to do, and that is launch an object towards a RaycastHit2D.point and have some velocity after passing through it. I can’t figure out how to calculate and then apply the velocity in the direction of the object hit. Here’s an image of what I am trying to accomplish:

I need it to work from any angle below the object (position 1 or 2). I’ve gotten close, but my results either go in a wrong direction or have incorrect force. I’ve been easily able to teleport the player (this maintains velocity) to the object by just setting the `transform.position = hit.point` but that’s not my goal.

Any help would be appreciated, thank you.

So I found some help in the manual that I missed before. https://docs.unity3d.com/Manual/DirectionDistanceFromOneObjectToAnother.html

This helped me understand what the vector was acting as. Once I figured out how the values gave it direction I was able to play around with the movement more. I ended up doing this to get the physics I wanted:

``````if (Vector2.Distance(transform.position, hookHitLocation) > .5f) {

velocity = hookHitLocation - (Vector2)transform.position;
velocity.Normalize ();
velocity += velocity * launchMultiplier;
}
``````